|
@@ -170,3 +170,28 @@ class TestDocGeneration(Base):
|
170
|
170
|
assert 'post' in doc['paths']['/upload']
|
171
|
171
|
assert 'tags' in doc['paths']['/upload']['post']
|
172
|
172
|
assert ['foo', 'bar'] == doc['paths']['/upload']['post']['tags']
|
|
173
|
+
|
|
174
|
+ def test_func__errors__nominal_case(self):
|
|
175
|
+ hapic = Hapic()
|
|
176
|
+ app = bottle.Bottle()
|
|
177
|
+ hapic.set_context(MyContext(app=app))
|
|
178
|
+
|
|
179
|
+ @hapic.with_api_doc()
|
|
180
|
+ @hapic.handle_exception()
|
|
181
|
+ def my_controller(hapic_data=None):
|
|
182
|
+ assert hapic_data
|
|
183
|
+
|
|
184
|
+ app.route('/upload', method='POST', callback=my_controller)
|
|
185
|
+ doc = hapic.generate_doc()
|
|
186
|
+
|
|
187
|
+ assert doc.get('paths')
|
|
188
|
+ assert '/upload' in doc['paths']
|
|
189
|
+ assert 'post' in doc['paths']['/upload']
|
|
190
|
+ assert 'responses' in doc['paths']['/upload']['post']
|
|
191
|
+ assert 500 in doc['paths']['/upload']['post']['responses']
|
|
192
|
+ assert {
|
|
193
|
+ 'description': 500,
|
|
194
|
+ 'schema': {
|
|
195
|
+ '$ref': '#/definitions/DefaultErrorBuilder'
|
|
196
|
+ }
|
|
197
|
+ } == doc['paths']['/upload']['post']['responses'][500]
|