From 0e66fa5c80b38837beb931a04d0c2eaa8319c0fe Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 22 Mar 2026 16:21:31 +0000 Subject: [PATCH] Add conftest.py and remaining test files --- tests/conftest.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..52daa54 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,73 @@ +import pytest + + +@pytest.fixture +def sample_har_data(): + return { + "log": { + "version": "1.2", + "creator": {"name": "Test", "version": "1.0"}, + "entries": [ + { + "startedDateTime": "2024-01-01T00:00:00.000Z", + "time": 100, + "request": { + "method": "GET", + "url": "https://api.example.com/users/123", + "headers": [ + {"name": "Content-Type", "value": "application/json"}, + {"name": "Authorization", "value": "Bearer test_token"}, + ], + "queryString": [{"name": "include", "value": "profile"}], + "postData": None, + }, + "response": { + "status": 200, + "statusText": "OK", + "headers": [ + {"name": "Content-Type", "value": "application/json"}, + ], + "content": { + "mimeType": "application/json", + "text": '{"id": 123, "name": "John Doe", "email": "john@example.com"}', + }, + }, + }, + { + "startedDateTime": "2024-01-01T00:00:01.000Z", + "time": 200, + "request": { + "method": "POST", + "url": "https://api.example.com/users", + "headers": [ + {"name": "Content-Type", "value": "application/json"}, + ], + "queryString": [], + "postData": { + "mimeType": "application/json", + "text": '{"name": "Jane Doe", "email": "jane@example.com"}', + }, + }, + "response": { + "status": 201, + "statusText": "Created", + "headers": [ + {"name": "Content-Type", "value": "application/json"}, + ], + "content": { + "mimeType": "application/json", + "text": '{"id": 456, "name": "Jane Doe", "email": "jane@example.com", "created_at": "2024-01-01T00:00:01Z"}', + }, + }, + }, + ], + } + } + + +@pytest.fixture +def sample_har_file(tmp_path, sample_har_data): + import json + har_file = tmp_path / "test.har" + har_file.write_text(json.dumps(sample_har_data)) + return str(har_file)