@@ -152,13 +152,26 @@ def test_specs_endpoint_no_host(self, app, client):
152
152
153
153
data = client .get_specs ('' )
154
154
assert 'host' not in data
155
+ assert data ['basePath' ] == '/'
155
156
157
+ @pytest .mark .options (server_name = 'api.restplus.org' )
156
158
def test_specs_endpoint_host (self , app , client ):
157
- app .config ['SERVER_NAME' ] = 'api.restplus.org'
159
+ # app.config['SERVER_NAME'] = 'api.restplus.org'
158
160
restplus .Api (app )
159
161
160
162
data = client .get_specs ('' )
161
163
assert data ['host' ] == 'api.restplus.org'
164
+ assert data ['basePath' ] == '/'
165
+
166
+ @pytest .mark .options (server_name = 'api.restplus.org' )
167
+ def test_specs_endpoint_host_with_url_prefix (self , app , client ):
168
+ blueprint = Blueprint ('api' , __name__ , url_prefix = '/api/1' )
169
+ restplus .Api (blueprint )
170
+ app .register_blueprint (blueprint )
171
+
172
+ data = client .get_specs ('/api/1' )
173
+ assert data ['host' ] == 'api.restplus.org'
174
+ assert data ['basePath' ] == '/api/1'
162
175
163
176
@pytest .mark .options (server_name = 'restplus.org' )
164
177
def test_specs_endpoint_host_and_subdomain (self , app , client ):
@@ -168,6 +181,7 @@ def test_specs_endpoint_host_and_subdomain(self, app, client):
168
181
169
182
data = client .get_specs (base_url = 'http://api.restplus.org' )
170
183
assert data ['host' ] == 'api.restplus.org'
184
+ assert data ['basePath' ] == '/'
171
185
172
186
def test_specs_endpoint_tags_short (self , app , client ):
173
187
restplus .Api (app , tags = ['tag-1' , 'tag-2' , 'tag-3' ])
0 commit comments