Skip to content

Commit 5466b6e

Browse files
authored
Merge pull request #50 from cp2boston/RCB-408_version_check_error_response
Added test for 409, incompatibleClientVersion
2 parents 40cbe70 + 3bac93b commit 5466b6e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_rosette_api.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ def json_429(scope="module"):
5353
return body
5454

5555

56+
@pytest.fixture
57+
def json_409(scope="module"):
58+
body = json.dumps({'code': 'incompatibleClientVersion', 'message': 'the version of client library used is not compatible with this server', 'versionChecked': True})
59+
return body
60+
61+
5662
@pytest.fixture
5763
def doc_params(scope="module"):
5864
params = DocumentParameters()
@@ -149,6 +155,21 @@ def test_for_429(api, json_429):
149155
httpretty.disable()
150156
httpretty.reset()
151157

158+
# Test for 429
159+
160+
161+
def test_for_409(api, json_409):
162+
httpretty.enable()
163+
httpretty.register_uri(httpretty.GET, "https://api.rosette.com/rest/v1/info",
164+
body=json_409, status=409, content_type="application/json")
165+
166+
with pytest.raises(RosetteException) as e_rosette:
167+
result = api.info()
168+
169+
assert e_rosette.value.status == 'incompatibleClientVersion'
170+
httpretty.disable()
171+
httpretty.reset()
172+
152173
# Test the language endpoint
153174

154175

0 commit comments

Comments
 (0)