def test_hook(self): runboom(self.server, method='POST', num=10, concurrency=1, hook='boom.tests.hook') res = self.get('/calls').content self.assertEqual(int(res), 10)
def test_pre_hook(self): runboom(self.server, method='POST', num=10, concurrency=1, pre_hook='boom.tests.test_boom.pre_hook', quiet=True) res = self.get('/calls').content self.assertEqual(int(res), 10)
def test_post_hook(self): run_results = runboom( self.server, method='GET', num=10, concurrency=1, post_hook='boom.tests.test_boom.post_hook', quiet=True) res = self.get('/calls').content self.assertEqual(run_results.errors, []) self.assertEqual(int(res), 10)
def test_connection_error(self): run_results = runboom( 'http://localhost:9999', num=10, concurrency=1, quiet=True) self.assertEqual(len(run_results.errors), 10) for error in run_results.errors: self.assertIsInstance(error, requests.ConnectionError)
def test_too_many_redirects(self): run_results = runboom( self.server + '/redir', num=2, concurrency=1, quiet=True) res = self.get('/calls').content self.assertEqual(int(res), 62) for error in run_results.errors: self.assertIsInstance(error, requests.TooManyRedirects)
def test_post_hook_fails(self): run_results = runboom( self.server, method='GET', num=10, concurrency=1, post_hook='boom.tests.test_boom.post_hook_fails', quiet=True) res = self.get('/calls').content self.assertEqual(len(run_results.errors), 10) for err in run_results.errors: self.assertEqual(True, isinstance(err, RequestException)) self.assertEqual(err.message, 'missing pattern') self.assertEqual(int(res), 10)
def test_post_hook_fails(self): run_results = runboom( self.server, method='GET', num=10, concurrency=1, post_hook='boom.tests.test_boom.post_hook_fails', quiet=True) res = self.get('/calls').content self.assertEqual(len(run_results.errors), 10) for err in run_results.errors: self.assertEqual(True, isinstance(err, RequestException)) self.assertEqual(err.__str__(), 'missing pattern') self.assertEqual(int(res), 10)
def test_post_hook_fails(self): run_results = runboom( self.server, method="GET", num=10, concurrency=1, post_hook="boom.tests.test_boom.post_hook_fails", quiet=True, ) res = self.get("/calls").content self.assertEqual(len(run_results.errors), 10) for err in run_results.errors: self.assertEqual(True, isinstance(err, RequestException)) self.assertEqual(err.message, "missing pattern") self.assertEqual(int(res), 10)
def test_basic_run(self): runboom(self.server, num=10, concurrency=1) res = requests.get(self.server + 'calls').content self.assertEqual(int(res), 10 + 1)
def test_connection_error(self): errors = runboom('http://localhost:9999', num=10, concurrency=1) self.assertEqual(len(errors), 10) for error in errors: self.assertIsInstance(error, requests.ConnectionError)
def test_basic_run(self): runboom(self.server, num=10, concurrency=1, quiet=True) res = self.get('/calls').content self.assertEqual(int(res), 10)
def test_pre_hook(self): runboom(self.server, method="POST", num=10, concurrency=1, pre_hook="boom.tests.test_boom.pre_hook", quiet=True) res = self.get("/calls").content self.assertEqual(int(res), 10)
def test_too_many_redirects(self): errors = runboom(self.server + 'redir', num=2, concurrency=1) res = requests.get(self.server + 'calls').content self.assertEqual(int(res), 62 + 1) for error in errors: self.assertIsInstance(error, requests.TooManyRedirects)