33import json
44import requests
55import pytest
6- from hcloud import HcloudClient , HcloudAPIException
6+ from hcloud import HcloudClient , APIException
77
88
99class TestHetznerClient (object ):
@@ -87,7 +87,7 @@ def test_request_ok(self, mocked_requests, client, response):
8787
8888 def test_request_fails (self , mocked_requests , client , fail_response ):
8989 mocked_requests .request .return_value = fail_response
90- with pytest .raises (HcloudAPIException ) as exception_info :
90+ with pytest .raises (APIException ) as exception_info :
9191 client .request ("POST" , "http://url.com" , params = {"argument" : "value" }, timeout = 2 )
9292 error = exception_info .value
9393 assert error .code == "invalid_input"
@@ -99,7 +99,7 @@ def test_request_500(self, mocked_requests, client, fail_response):
9999 fail_response .reason = "Internal Server Error"
100100 fail_response ._content = "Internal Server Error"
101101 mocked_requests .request .return_value = fail_response
102- with pytest .raises (HcloudAPIException ) as exception_info :
102+ with pytest .raises (APIException ) as exception_info :
103103 client .request ("POST" , "http://url.com" , params = {"argument" : "value" }, timeout = 2 )
104104 error = exception_info .value
105105 assert error .code == 500
@@ -111,7 +111,7 @@ def test_request_broken_json_200(self, mocked_requests, client, response):
111111 response .reason = "OK"
112112 response ._content = content
113113 mocked_requests .request .return_value = response
114- with pytest .raises (HcloudAPIException ) as exception_info :
114+ with pytest .raises (APIException ) as exception_info :
115115 client .request ("POST" , "http://url.com" , params = {"argument" : "value" }, timeout = 2 )
116116 error = exception_info .value
117117 assert error .code == 200
@@ -131,7 +131,7 @@ def test_request_500_empty_content(self, mocked_requests, client, fail_response)
131131 fail_response .reason = "Internal Server Error"
132132 fail_response ._content = ""
133133 mocked_requests .request .return_value = fail_response
134- with pytest .raises (HcloudAPIException ) as exception_info :
134+ with pytest .raises (APIException ) as exception_info :
135135 client .request ("POST" , "http://url.com" , params = {"argument" : "value" }, timeout = 2 )
136136 error = exception_info .value
137137 assert error .code == 500
@@ -141,7 +141,7 @@ def test_request_500_empty_content(self, mocked_requests, client, fail_response)
141141 def test_request_limit (self , mocked_requests , client , rate_limit_response ):
142142 client .retry_wait_time = 0
143143 mocked_requests .request .return_value = rate_limit_response
144- with pytest .raises (HcloudAPIException ) as exception_info :
144+ with pytest .raises (APIException ) as exception_info :
145145 client .request ("POST" , "http://url.com" , params = {"argument" : "value" }, timeout = 2 )
146146 error = exception_info .value
147147 assert mocked_requests .request .call_count == 5
0 commit comments