|
@@ -124,3 +124,26 @@ class TestDocGeneration(Base):
|
124
|
124
|
'in': 'formData',
|
125
|
125
|
'type': 'file',
|
126
|
126
|
} in doc['paths']['/upload']['post']['parameters']
|
|
127
|
+
|
|
128
|
+ def test_func__docstring__ok__simple_case(self):
|
|
129
|
+ hapic = Hapic()
|
|
130
|
+ hapic.set_context(MyContext())
|
|
131
|
+ app = bottle.Bottle()
|
|
132
|
+
|
|
133
|
+ # TODO BS 20171113: Make this test non-bottle
|
|
134
|
+ @hapic.with_api_doc()
|
|
135
|
+ def my_controller(hapic_data=None):
|
|
136
|
+ """
|
|
137
|
+ Hello doc
|
|
138
|
+ """
|
|
139
|
+ assert hapic_data
|
|
140
|
+ assert hapic_data.files
|
|
141
|
+
|
|
142
|
+ app.route('/upload', method='POST', callback=my_controller)
|
|
143
|
+ doc = hapic.generate_doc(app)
|
|
144
|
+
|
|
145
|
+ assert doc.get('paths')
|
|
146
|
+ assert '/upload' in doc['paths']
|
|
147
|
+ assert 'post' in doc['paths']['/upload']
|
|
148
|
+ assert 'description' in doc['paths']['/upload']['post']
|
|
149
|
+ assert 'Hello doc' == doc['paths']['/upload']['post']['description']
|