Skip to content

Commit c6cccdd

Browse files
committed
Added CBOR fixtures
1 parent 783e4e5 commit c6cccdd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/conftest.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ def open(self, *args, **kwargs):
5353
return super().open(*args, **kwargs)
5454

5555

56+
class CborClient(FlaskClient):
57+
def open(self, *args, **kwargs):
58+
kwargs.setdefault(
59+
"headers",
60+
{"Content-Type": "application/json", "Accept": "application/cbor"},
61+
)
62+
kwargs.setdefault("content_type", "application/json")
63+
return super().open(*args, **kwargs)
64+
65+
5666
class SocketClient(FlaskClient):
5767
def __init__(self, app, response_wrapper, *args, **kwargs):
5868
super().__init__(app, response_wrapper, *args, **kwargs)
@@ -236,6 +246,17 @@ def client(app):
236246
return app.test_client()
237247

238248

249+
@pytest.fixture
250+
def cbor_client(app):
251+
app.test_client_class = CborClient
252+
return app.test_client()
253+
254+
255+
@pytest.fixture
256+
def text_client(app):
257+
return app.test_client()
258+
259+
239260
@pytest.fixture
240261
def ws_client(app):
241262
app.test_client_class = SocketClient

0 commit comments

Comments
 (0)