summaryrefslogtreecommitdiff
path: root/tests/unit/test_backends.py
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2023-02-12 12:30:29 +0100
committerNejc Habjan <nejc.habjan@siemens.com>2023-03-12 09:39:54 +0100
commitab089fbf04d8946a4748723dfd3029a943a43b2f (patch)
tree26a7d0c534abfbeffbe54808ffa3e755db85479e /tests/unit/test_backends.py
parent07d03dc959128e05d21e8dfd79aa8e916ab5b150 (diff)
downloadgitlab-refactor/response-content-backend.tar.gz
refactor: move response_content into backend coderefactor/response-content-backend
Diffstat (limited to 'tests/unit/test_backends.py')
-rw-r--r--tests/unit/test_backends.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unit/test_backends.py b/tests/unit/test_backends.py
new file mode 100644
index 0000000..a70e4ef
--- /dev/null
+++ b/tests/unit/test_backends.py
@@ -0,0 +1,23 @@
+import requests
+import responses
+
+from gitlab import _backends
+
+
+@responses.activate
+def test_streamed_response_content_with_requests(capsys):
+ responses.add(
+ method="GET",
+ url="https://example.com",
+ status=200,
+ body="test",
+ content_type="application/octet-stream",
+ )
+
+ resp = requests.get("https://example.com", stream=True)
+ _backends.RequestsBackend.response_content(
+ resp, streamed=True, action=None, chunk_size=1024, iterator=False
+ )
+
+ captured = capsys.readouterr()
+ assert "test" in captured.out