Example #1
0
 def test_single_count(self):
     """
     Adds ``request_rate`` samples per call.
     """
     calls_per_second = 10
     clock = Clock()
     request = TestRequest()
     scenario = RequestLoadScenario(clock,
                                    request,
                                    request_rate=calls_per_second)
     scenario._request_and_measure(1)
     self.assertEqual(scenario.rate_measurer.get_metrics()['ok_count'],
                      calls_per_second)
Example #2
0
 def test_multiple_count(self):
     """
     The count controls how many requests are made.
     """
     calls_per_second = 10
     seconds = 2
     clock = Clock()
     request = TestRequest()
     scenario = RequestLoadScenario(clock,
                                    request,
                                    request_rate=calls_per_second)
     scenario._request_and_measure(seconds)
     self.assertEqual(scenario.rate_measurer.get_metrics()['ok_count'],
                      calls_per_second * seconds)