示例#1
0
文件: test_boom.py 项目: rbas/boom
 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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#12
0
文件: tests.py 项目: anarcher/boom
 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)
示例#13
0
文件: test_boom.py 项目: rbas/boom
 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)
示例#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)
示例#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)
示例#16
0
文件: test_boom.py 项目: rbas/boom
 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)
示例#17
0
文件: test_boom.py 项目: rbas/boom
 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)
示例#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)
示例#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)
示例#20
0
文件: tests.py 项目: 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)