@@ -111,26 +111,6 @@ def get_data(self):
111111 }
112112
113113
114- class ModelUndefinedContext (views .ContextView ):
115- """Model undefined"""
116-
117- def get_data (self ):
118- pass
119-
120-
121- class WrongModelContext (views .ContextView ):
122- """Wrong model defined."""
123- __model_cls__ = type
124-
125- def get_data (self ):
126- pass
127-
128-
129- class GetterUndefinedContext (views .ContextView ):
130- """Getter undefined."""
131- __model_cls__ = Profile
132-
133-
134114class TestContextView (unittest .TestCase ):
135115 main_photo = Photo (id = 1 , title = 'main photo' , path = 'path/to/the/main/photo' ,
136116 public = True )
@@ -151,14 +131,19 @@ def test_wrong_model_passed(self):
151131 PublicProfile ("invalid argument" )
152132
153133 def test_model_undefined (self ):
154- with self .assertRaises (TypeError ):
155- ModelUndefinedContext ("it doesn't matter" )
134+ with self .assertRaises (AttributeError ):
135+ class ModelUndefinedContext (views .ContextView ):
136+ pass
156137
157138 def test_wrong_model_defined (self ):
158139 with self .assertRaises (TypeError ):
159- WrongModelContext ("it doesn't matter" )
140+ class WrongModelContext (views .ContextView ):
141+ __model_cls__ = type
160142
161143 def test_getter_undefined (self ):
144+ class GetterUndefinedContext (views .ContextView ):
145+ __model_cls__ = Profile
146+
162147 contextual_view = GetterUndefinedContext (self .profile )
163148 with self .assertRaises (NotImplementedError ):
164149 contextual_view .get_data ()
0 commit comments