server_test.py 文件源码

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

项目:PowerSpikeGG 作者: PowerSpikeGG 项目源码 文件源码
def test_match_fetching(self):
        """Check if the server handle correctly a normal request."""
        # 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 = None
        self.service.riot_api_handler.get_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
        converter = JSONConverter(None)
        expected = converter.json_match_to_match_pb(self.match_data)
        self.assertEqual(response, expected)
        self.assertTrue(self.service.cache_manager.save_match.called)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号