Skip to content

Commit

Permalink
Adds a couple more tests for inheritance scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
apiguy committed Mar 25, 2014
1 parent 7c023bc commit 553bb57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test_classy/test_inheritance.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from flask import Flask
from .view_classes import InheritanceView
from .view_classes import InheritanceView, DecoratedInheritanceView
from nose.tools import *

app = Flask('inheritance')
InheritanceView.register(app)
DecoratedInheritanceView.register(app)

client = app.test_client()

Expand Down Expand Up @@ -35,4 +36,14 @@ def test_override_with_route():

def test_inherited_base_route():
resp = client.get("/inheritance/routed/")
eq_(b"Routed Method", resp.data)
eq_(b"Routed Method", resp.data)


def test_decorated_inherited_mixitup():
resp = client.get("/decoratedinheritance/mixitup/")
eq_(b"Mix It Up", resp.data)


def test_decorated_inheritance_get():
resp = client.get("/decoratedinheritance/1234")
eq_(b"Decorated Inheritance Get 1234", resp.data)
7 changes: 7 additions & 0 deletions test_classy/view_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ def with_route(self):
return "Inheritance with route"


class DecoratedInheritanceView(DecoratedView):

@recursive_decorator
def get(self, obj_id):
return "Decorated Inheritance Get " + obj_id


class TrailingSlashView(FlaskView):
trailing_slash = False
route_base = '/trailing/'
Expand Down

0 comments on commit 553bb57

Please sign in to comment.