Exemple #1
0
        def test_http_post_type(self):
            """Test the HTTP POST request return value type"""
            http = HTTP("https://raw.github.com/chrissimpkins/six-four/master/LICENSE")
            http_text = http.post()

            if state.py2:
                self.assertEqual(type(u"test string"), type(http_text))
            else:
                self.assertEqual(type(str("test string")), type(http_text))
Exemple #2
0
        def test_http_post_type(self):
            """Test the HTTP POST request return value type"""
            http = HTTP(
                "https://raw.github.com/chrissimpkins/six-four/master/LICENSE")
            http_text = http.post()

            if state.py2:
                self.assertEqual(type(u"test string"), type(http_text))
            else:
                self.assertEqual(type(str("test string")), type(http_text))
Exemple #3
0
 def test_http_post_response_status_200_ssl(self):
     """Test that the status code 200 is appropriately detected after a SSL POST request"""
     http = HTTP("https://httpbin.org/post")
     http.post()
     self.assertEqual(http.res.status_code, 200)
Exemple #4
0
 def test_http_get_response_method_return_value_missingsite(self):
     """Test the return type from response() method when non-existent site is requested"""
     http = HTTP('http://www.abogussitename.com')
     http.post()
     self.assertEqual(None, http.response())
Exemple #5
0
 def test_http_get_response_content_object_missingsite(self):
     """Test the contents of the response object returned by requests when site is non-existent"""
     http = HTTP('http://www.abogussitename.com')
     http.post()
     with self.assertRaises(AttributeError):
         http.res.content # confirm that attempt to access the content attribute of res raises Exception when no site
Exemple #6
0
 def test_http_POST_response_object_missingsite(self):
     """Test the POST response object returned by requests when site is non-existent"""
     http = HTTP('http://www.abogussitename.com')
     http.post()
     self.assertEqual(None, http.res)
Exemple #7
0
 def test_http_post_contents_response_missingsite(self):
     """Test the contents of the POST request response when the site is non-existent"""
     http = HTTP('http://www.abogussitename.com')
     self.assertEqual(False, http.post()) # returns False if requests ConnectionError
Exemple #8
0
 def test_http_post_ssl(self):
     """Test HTTP POST request content data"""
     http = HTTP("https://httpbin.org/post")
     http_text = http.post()
     response = http.response()
     self.assertEqual(response.url, 'https://httpbin.org/post')
Exemple #9
0
 def test_http_post_response_status_200_ssl(self):
     """Test that the status code 200 is appropriately detected after a SSL POST request"""
     http = HTTP("https://httpbin.org/post")
     http.post()
     self.assertEqual(http.res.status_code, 200)
Exemple #10
0
 def test_http_get_response_method_return_value_missingsite(self):
     """Test the return type from response() method when non-existent site is requested"""
     http = HTTP('http://www.abogussitename.com')
     http.post()
     self.assertEqual(None, http.response())
Exemple #11
0
 def test_http_get_response_content_object_missingsite(self):
     """Test the contents of the response object returned by requests when site is non-existent"""
     http = HTTP('http://www.abogussitename.com')
     http.post()
     with self.assertRaises(AttributeError):
         http.res.content  # confirm that attempt to access the content attribute of res raises Exception when no site
Exemple #12
0
 def test_http_POST_response_object_missingsite(self):
     """Test the POST response object returned by requests when site is non-existent"""
     http = HTTP('http://www.abogussitename.com')
     http.post()
     self.assertEqual(None, http.res)
Exemple #13
0
 def test_http_post_contents_response_missingsite(self):
     """Test the contents of the POST request response when the site is non-existent"""
     http = HTTP('http://www.abogussitename.com')
     self.assertEqual(
         False,
         http.post())  # returns False if requests ConnectionError
Exemple #14
0
 def test_http_post_ssl(self):
     """Test HTTP POST request content data"""
     http = HTTP("https://httpbin.org/post")
     http_text = http.post()
     response = http.response()
     self.assertEqual(response.url, 'https://httpbin.org/post')