Skip to content

Commit d0e1bbf

Browse files
committed
add working test case for explicit params
We will later make it fail, but want to show a nice diff in the next commit.
1 parent 8b4a9cc commit d0e1bbf

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

test_classy/test_decorators.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@ def test_params_decorator_delete():
5656
eq_(b"Params Decorator Delete 1234", resp.data)
5757

5858

59-
59+
def test_explicit_params_decorator():
60+
resp = client.get('/decorated/explicit/foo/bar')
61+
eq_(b"Explicit param foobar", resp.data)

test_classy/view_classes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ def decorated_function(*args, **kwargs):
186186
return decorator
187187

188188

189+
def explicit_params_decorator(f):
190+
@wraps(f)
191+
def wrapper(*args, **kwargs):
192+
return f(*args, **kwargs)
193+
return wrapper
194+
195+
189196
def recursive_decorator(f):
190197
@wraps(f)
191198
def decorated_view(*args, **kwargs):
@@ -253,6 +260,9 @@ def someval(self, val):
253260
def anotherval(self, val):
254261
return "Anotherval " + val
255262

263+
@explicit_params_decorator
264+
def explicit(self, arg1, arg2):
265+
return "Explicit param " + arg1 + arg2
256266

257267

258268
class InheritanceView(BasicView):

0 commit comments

Comments
 (0)