Esempio n. 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')
Esempio n. 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
Esempio n. 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())
Esempio n. 4
0
 def test_run_bad_command(self):
     self.assertEqual(False, run(self.bad_command))
Esempio n. 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))
Esempio n. 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')
Esempio n. 7
0
 def test_run_good_command(self):
     self.assertEqual(b"test command\n", run(self.good_command))
Esempio n. 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')
Esempio n. 9
0
 def test_run_good_command(self):
     self.assertEqual(b"test command\n", run(self.good_command))
Esempio n. 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')
Esempio n. 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')
Esempio n. 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')
Esempio n. 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())
Esempio n. 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')
Esempio n. 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')
Esempio n. 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
Esempio n. 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')
Esempio n. 18
0
 def test_run_bad_command(self):
     self.assertEqual(False, run(self.bad_command))
Esempio n. 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')
Esempio n. 20
0
 def test_run_bad_command_output(self):
     test_string = run(self.bad_command)
     self.assertEqual(False, run(self.bad_command))
Esempio n. 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
Esempio n. 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))
Esempio n. 23
0
 def test_run_bad_command_output(self):
     test_string = run(self.bad_command)
     self.assertEqual(False, run(self.bad_command))
Esempio n. 24
0
 def test_run_missing_option(self):
     self.assertEqual(False, run(self.missing_option))
Esempio n. 25
0
 def test_run_missing_option(self):
     self.assertEqual(False, run(self.missing_option))
Esempio n. 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()