示例#1
0
 def test_get_status404_with_protocol(self):
     """Test that a status 404 is appropriately returned with GET"""
     response = run("status " + self.get_status404)
     self.assertEqual(response.strip().decode('ascii'), '404 : http://httpbin.org/status/404')
示例#2
0
 def get_git_log(self):
     log_output = run('git log --numstat --reverse', suppress_stdout=True, suppress_stderr=False)
     if not log_output:
         print('Error fetching git log', file=sys.stderr)
         exit_fail()
     return log_output
示例#3
0
 def test_get_status301_with_protocol(self):
     """Test that a status 301 and bounces are appropriately returned with GET"""
     response = run("status " + self.get_status301)
     self.assertEqual(response.strip().decode('ascii'), self.string_301.strip())
示例#4
0
 def test_run_bad_command(self):
     self.assertEqual(False, run(self.bad_command))
示例#5
0
 def test_run_bad_command_output(self):
     with self.assertRaises(
             SystemExit
     ):  # raises SystemExit when suppress_exit_status_call = False
         self.assertEqual(
             False, run(self.bad_command, suppress_exit_status_call=False))
示例#6
0
 def test_post_p_status200_without_protocol(self):
     """Test that a status 200 is appropriately returned with POST using -p and no protocol"""
     response = run("status -p " + self.post_noprotocol)
     self.assertEqual(response.strip().decode('ascii'), '200 : http://httpbin.org/post')
示例#7
0
 def test_run_good_command(self):
     self.assertEqual(b"test command\n", run(self.good_command))
示例#8
0
 def test_post_post_status200_without_protocol(self):
     """Test that a status 200 is appropriately returned with POST using --post and no protocol"""
     response = run("status --post " + self.post_noprotocol)
     self.assertEqual(response.strip().decode('ascii'),
                      '200 : http://httpbin.org/post')
示例#9
0
 def test_run_good_command(self):
     self.assertEqual(b"test command\n", run(self.good_command))
示例#10
0
 def test_get_status200_without_protocol(self):
     """Test that a status 200 is returned appropriately when no protocol included"""
     response = run("status " + self.get_noprotocol)
     self.assertEqual(response.strip().decode('ascii'),
                      '200 : http://httpbin.org/status/200')
示例#11
0
 def test_get_status200_ssl_protocol(self):
     """Test that a status 200 is returned appropriately with SSL protocol"""
     response = run("status " + self.get_ssl_protocol)
     self.assertEqual(response.strip().decode('ascii'),
                      '200 : https://httpbin.org/status/200')
示例#12
0
 def test_get_status404_with_protocol(self):
     """Test that a status 404 is appropriately returned with GET"""
     response = run("status " + self.get_status404)
     self.assertEqual(response.strip().decode('ascii'),
                      '404 : http://httpbin.org/status/404')
示例#13
0
 def test_get_status301_with_protocol(self):
     """Test that a status 301 and bounces are appropriately returned with GET"""
     response = run("status " + self.get_status301)
     self.assertEqual(response.strip().decode('ascii'),
                      self.string_301.strip())
示例#14
0
 def test_post_p_status200_ssl(self):
     """Test that a status 200 is appropriately returned with POST using -p and https://"""
     response = run("status -p " + self.post_ssl_protocol)
     self.assertEqual(response.strip().decode('ascii'),
                      '200 : https://httpbin.org/post')
示例#15
0
 def test_get_status200_without_protocol(self):
     """Test that a status 200 is returned appropriately when no protocol included"""
     response = run("status " + self.get_noprotocol)
     self.assertEqual(response.strip().decode('ascii'), '200 : http://httpbin.org/status/200')
示例#16
0
 def test_run_good_command_suppress_stdout(self):
     self.assertEqual(b"test command\n", run(self.good_command, suppress_stdout=True)) # still receive return value when stout print suppressed
示例#17
0
 def test_get_status200_ssl_protocol(self):
     """Test that a status 200 is returned appropriately with SSL protocol"""
     response = run("status " + self.get_ssl_protocol)
     self.assertEqual(response.strip().decode('ascii'), '200 : https://httpbin.org/status/200')
示例#18
0
 def test_run_bad_command(self):
     self.assertEqual(False, run(self.bad_command))
示例#19
0
 def test_post_post_status200_ssl(self):
     """Test that a status 200 is appropriately returned with POST using --post and https://"""
     response = run("status --post " + self.post_ssl_protocol)
     self.assertEqual(response.strip().decode('ascii'), '200 : https://httpbin.org/post')
示例#20
0
 def test_run_bad_command_output(self):
     test_string = run(self.bad_command)
     self.assertEqual(False, run(self.bad_command))
示例#21
0
 def test_run_good_command_suppress_stdout(self):
     self.assertEqual(
         b"test command\n", run(self.good_command, suppress_stdout=True)
     )  # still receive return value when stout print suppressed
示例#22
0
 def test_run_bad_command_output(self):
     with self.assertRaises(SystemExit): # raises SystemExit when suppress_exit_status_call = False
         self.assertEqual(False, run(self.bad_command, suppress_exit_status_call=False))
示例#23
0
 def test_run_bad_command_output(self):
     test_string = run(self.bad_command)
     self.assertEqual(False, run(self.bad_command))
示例#24
0
 def test_run_missing_option(self):
     self.assertEqual(False, run(self.missing_option))
示例#25
0
 def test_run_missing_option(self):
     self.assertEqual(False, run(self.missing_option))
示例#26
0
 def ensure_git_repo(self):
     status_output = run('git status', suppress_stdout=True, suppress_stderr=True)
     if not status_output:
         print('Please run this command in a git repository', file=sys.stderr)
         exit_fail()