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