@@ -135,5 +135,42 @@ def test_return_value_ok_returns_expected_title(self):
135
135
output , 'title' , 'TEST' , trim_newlines = True )
136
136
137
137
138
+ class MigWsgibin_output_objects (MigTestCase , HtmlAssertMixin , WsgiAssertMixin ):
139
+
140
+ def _provide_configuration (self ):
141
+ return 'testconfig'
142
+
143
+ def before_each (self ):
144
+ self .fake_backend = FakeBackend ()
145
+ self .fake_wsgi = prepare_wsgi (self .configuration , 'http://localhost/' )
146
+
147
+ self .application_args = (
148
+ self .configuration ,
149
+ self .fake_wsgi .environ ,
150
+ self .fake_wsgi .start_response ,
151
+ )
152
+ self .application_kwargs = dict (
153
+ configuration = self .configuration ,
154
+ _import_module = self .fake_backend .to_import_module (),
155
+ _set_os_environ = False ,
156
+ )
157
+
158
+ def test_unknown_object_type_generates_valid_error_page (self ):
159
+ output_objects = [
160
+ {
161
+ 'object_type' : 'nonexistent' , # trigger error handling path
162
+ }
163
+ ]
164
+ self .fake_backend .set_response (output_objects , returnvalues .OK )
165
+
166
+ wsgi_result = migwsgi .application (
167
+ * self .application_args ,
168
+ ** self .application_kwargs
169
+ )
170
+
171
+ output , _ = self .assertWsgiResponse (wsgi_result , self .fake_wsgi , 200 )
172
+ self .assertIsValidHtmlDocument (html_output )
173
+
174
+
138
175
if __name__ == '__main__' :
139
176
testmain ()
0 commit comments