Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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)
Exemplo n.º 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())
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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())
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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')