def test_url2(self):
        """Test with two URLs"""

        for i in range(0, 20):
            self.client.get('/url2')

        # We make sure data processing is complete
        sleep(0.1)

        response = self.client.get('/flstats/')
        self.assertEqual(response.status, '200 OK')

        # Statistics tests
        data = json.loads(response.data)

        stats = data['stats']
        self.assertEqual(len(stats), 2)

        for stat in stats:
            if stat['url'] == 'http://localhost/url1':
                self.assertEqual(stat['throughput'], 0)
                self.assertTrue(stat['min'] <= stat['avg'] <= stat['max'])
            elif stat['url'] == 'http://localhost/url2':
                self.assertEqual(stat['throughput'], 20)
                self.assertTrue(stat['min'] <= stat['avg'] <= stat['max'])
            else:
                self.fail('Invalid URL, WTF?!')
dataset/ETHPy150Open yannlambret/flstats/flstats/flstats_tests.py/FlstatsTestCase.test_url2/original