Skip to content

Commit

Permalink
add working test case for explicit params
Browse files Browse the repository at this point in the history
We will later make it fail, but want to show a nice diff in the next
commit.
  • Loading branch information
iartarisi committed Aug 31, 2015
1 parent 8b4a9cc commit d0e1bbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test_classy/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ def test_params_decorator_delete():
eq_(b"Params Decorator Delete 1234", resp.data)



def test_explicit_params_decorator():
resp = client.get('/decorated/explicit/foo/bar')
eq_(b"Explicit param foobar", resp.data)
10 changes: 10 additions & 0 deletions test_classy/view_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ def decorated_function(*args, **kwargs):
return decorator


def explicit_params_decorator(f):
@wraps(f)
def wrapper(*args, **kwargs):
return f(*args, **kwargs)
return wrapper


def recursive_decorator(f):
@wraps(f)
def decorated_view(*args, **kwargs):
Expand Down Expand Up @@ -253,6 +260,9 @@ def someval(self, val):
def anotherval(self, val):
return "Anotherval " + val

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


class InheritanceView(BasicView):
Expand Down

0 comments on commit d0e1bbf

Please sign in to comment.