Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
    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)
Ejemplo n.º 10
0
    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)
Ejemplo n.º 11
0
    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)
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
 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)
Ejemplo n.º 14
0
 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)
Ejemplo n.º 15
0
 def test_basic_run(self):
     runboom(self.server, num=10, concurrency=1, quiet=True)
     res = self.get('/calls').content
     self.assertEqual(int(res), 10)
Ejemplo n.º 16
0
 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)
Ejemplo n.º 17
0
 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)
Ejemplo n.º 18
0
 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)
Ejemplo n.º 19
0
 def test_basic_run(self):
     runboom(self.server, num=10, concurrency=1, quiet=True)
     res = self.get('/calls').content
     self.assertEqual(int(res), 10)
Ejemplo n.º 20
0
Archivo: tests.py Proyecto: Wazoku/boom
 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)