def test__register_doc_blueprint__no_openapi_url_prefix(self): mock_self = Mock() mock_self._app.config = {'OPENAPI_URL_PREFIX': None} DocBlueprintMixin._register_doc_blueprint(mock_self) mock_self._register_redoc_rule.assert_not_called() mock_self._register_swagger_ui_rule.assert_not_called() mock_self._app.register_blueprint.assert_not_called()
def test__register_doc_blueprint(self, mock_add_url_rule): url = '/api/swagger' mock_self = Mock() mock_self._app.config = {'OPENAPI_URL_PREFIX': url} mock_self.decorators_for_autodoc = [self.some_dec] DocBlueprintMixin._register_doc_blueprint(mock_self) blueprint = mock_self._register_redoc_rule.call_args[0][0] assert blueprint.template_folder == './templates' assert blueprint.url_prefix == url mock_add_url_rule.assert_called_once_with(blueprint, '/openapi.json', endpoint='openapi_json', view_func=self.some_dec(mock_self._openapi_json)) mock_self._register_redoc_rule.assert_called_once_with(blueprint) mock_self._register_swagger_ui_rule.assert_called_once_with(blueprint) mock_self._app.register_blueprint.assert_called_once_with(blueprint)