示例#1
0
    def test_check_status_acceptable_codes(self):
        try:
            response = requests.Response()
            response.status_code = 200
            HttpRequests.check_status(response)
        except requests.HTTPError as e:
            pytest.fail(str(e))

        try:
            response = requests.Response()
            response.status_code = 202
            HttpRequests.check_status(response)
        except requests.HTTPError as e:
            pytest.fail(str(e))
示例#2
0
 def test_check_status_bad_codes(self):
     with pytest.raises(requests.HTTPError):
         response = requests.Response()
         response.status_code = 404
         HttpRequests.check_status(response)
     with pytest.raises(requests.HTTPError):
         response = requests.Response()
         response.status_code = 409
         HttpRequests.check_status(response)
     with pytest.raises(requests.HTTPError):
         response = requests.Response()
         response.status_code = 500
         HttpRequests.check_status(response)
     with pytest.raises(requests.HTTPError):
         response = requests.Response()
         response.status_code = 301
         HttpRequests.check_status(response)