def test_basepath_rewriting(): resource_json = {'basePath': 'bar'} view = build_swagger_12_api_declaration_view(resource_json) request = DummyRequest(application_url='foo') result = view(request) assert result['basePath'] == request.application_url assert result['basePath'] != resource_json['basePath']