Beispiel #1
0
 def test_stats_bad_request_resolution(self):
     msg = isolated_pb2.StatsRequest()
     msg.page_size = 1
     raw_resp = self.app.post('/prpc/isolated.v1.Isolated/Stats',
                              _encode(msg),
                              self._headers,
                              expect_errors=True)
     self.assertEqual(raw_resp.body, 'Invalid resolution')
Beispiel #2
0
 def test_stats_bad_request_page_size(self):
     msg = isolated_pb2.StatsRequest()
     msg.resolution = isolated_pb2.MINUTE
     raw_resp = self.app.post('/prpc/isolated.v1.Isolated/Stats',
                              _encode(msg),
                              self._headers,
                              expect_errors=True)
     self.assertEqual(raw_resp.body,
                      'Invalid page_size; must be between 1 and 1000')
Beispiel #3
0
 def _assert_stats(self, resolution, page_size, time, expected):
     self._gen_stats()
     msg = isolated_pb2.StatsRequest()
     if time:
         msg.latest_time.FromDatetime(time)
     msg.resolution = resolution
     msg.page_size = page_size
     raw_resp = self.app.post('/prpc/isolated.v1.Isolated/Stats',
                              _encode(msg), self._headers)
     resp = isolated_pb2.StatsResponse()
     _decode(raw_resp.body, resp)
     self.assertEqual(expected, unicode(resp))