command.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:flask-autofixture 作者: janukobytsch 项目源码 文件源码
def execute(self, response):
        """Generates fixture objects from the given response and stores them
        in the application-specific cache.

        :param response: the recorded :class:`Response`
        """
        if not has_request_context:
            return

        self._fallback_fixture_names()

        try:
            app = self.auto_fixture.app

            # Create response fixture
            fixture = Fixture.from_response(response, app, self.response_name)
            self.auto_fixture.add_fixture(fixture)

            # Create request fixture
            if request.data:
                fixture = Fixture.from_request(request, app, self.request_name)
                self.auto_fixture.add_fixture(fixture)
        except TypeError:  # pragma: no cover
            warnings.warn("Could not create fixture for unsupported mime type")

        return response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号