Skip to content

Commit 317a343

Browse files
committed
Issue #25: better test coverage
1 parent 470c1b9 commit 317a343

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/test_context_view.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ def name(self):
168168
class WrongContext(views.ContextView):
169169
__model_cls__ = Profile
170170
__include__ = (Profile.wrong_field,)
171-
__exclude__ = (Profile.one_more_wrong_field,)
171+
172+
with self.assertRaises(AttributeError):
173+
class WrongContext(views.ContextView):
174+
__model_cls__ = Profile
175+
__exclude__ = (Profile.wrong_field,)
172176

173177
def test_context_view(self):
174178
public_profile = ProfilePublicContext(self.profile)
@@ -262,3 +266,13 @@ def test_context_view(self):
262266
'path': 'path/to/the/photo3'
263267
}]
264268
})
269+
270+
class SomeContext(views.ContextView):
271+
__model_cls__ = Profile
272+
273+
@property
274+
def name(self):
275+
return " + ".join((self.__model__.name, "postfix"))
276+
277+
profile_within_context = SomeContext(self.profile)
278+
self.assertEqual(profile_within_context.name, 'John + postfix')

0 commit comments

Comments
 (0)