server_test.py 文件源码

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

项目:PowerSpikeGG 作者: PowerSpikeGG 项目源码 文件源码
def test_match_from_cache(self):
        """Check if the server returns a match from the cache."""
        # Forward sample data fetched from the Riot API directly as result
        this_dir = os.path.dirname(os.path.abspath(__file__))
        with open(os.sep.join([this_dir, "samples", self.MATCH_DATA])) as f:
            self.match_data = json.load(f)

        # Setup mocks
        self.service.cache_manager.find_match.return_value = self.match_data

        response = self.stub.Match(service_pb2.MatchRequest(id=4242,
            region=constants_pb2.EUW))

        # Check the conversion of the sample is matching the response
        self.assertTrue(self.service.cache_manager.find_match.called)
        self.assertFalse(self.service.riot_api_handler.get_match.called)
        self.assertFalse(self.service.cache_manager.save_match.called)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号