Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test non-standard response
  • Loading branch information
andrii-balitskyi committed Feb 12, 2025
commit 0204dce5f67f1b7218bb9bd812d007d414f9dfcd
16 changes: 16 additions & 0 deletions test/http_error_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
import niquests
from seam import Seam
from seam.exceptions import (
SeamHttpApiError,
Expand Down Expand Up @@ -44,3 +45,18 @@ def test_seam_http_throws_invalid_input_error(server):
assert err.status_code == 400
assert err.code == "invalid_input"
assert err.request_id.startswith("request")


def test_seam_http_throws_http_error_on_non_standard_response(server):
endpoint, seed = server
seam = Seam.from_api_key(seed["seam_apikey1_token"], endpoint=endpoint)

seam.client.post(
"/_fake/simulate_workspace_outage",
json={"workspace_id": seed["seed_workspace_1"], "routes": ["/devices/list"]},
)

with pytest.raises(niquests.HTTPError) as exc_info:
seam.devices.list()

assert exc_info.value.response.status_code == 503
Loading