From 6a630202db718c5ed2924ad3a3863d7eee391b88 Mon Sep 17 00:00:00 2001 From: halcy Date: Sat, 19 Nov 2022 00:53:25 +0200 Subject: add server rules API --- tests/cassettes/test_instance_rules.yaml | 60 ++++++++++++++++++++++++++++++++ tests/test_instance.py | 4 ++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/cassettes/test_instance_rules.yaml (limited to 'tests') diff --git a/tests/cassettes/test_instance_rules.yaml b/tests/cassettes/test_instance_rules.yaml new file mode 100644 index 0000000..6e144b6 --- /dev/null +++ b/tests/cassettes/test_instance_rules.yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN + Connection: + - keep-alive + User-Agent: + - tests/v311 + method: GET + uri: http://localhost:3000/api/v1/instance/rules + response: + body: + string: '[]' + headers: + Cache-Control: + - no-store + Content-Security-Policy: + - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src + ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; + style-src ''self'' http://localhost:3000 ''nonce-VfLfKge8CLCQB9dJyA6/cA==''; + media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' + https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' + data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 + ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' + ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; + worker-src ''self'' blob: http://localhost:3000' + Content-Type: + - application/json; charset=utf-8 + ETag: + - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5" + Referrer-Policy: + - strict-origin-when-cross-origin + Transfer-Encoding: + - chunked + Vary: + - Accept, Origin + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Frame-Options: + - SAMEORIGIN + X-Permitted-Cross-Domain-Policies: + - none + X-Request-Id: + - 48fd3107-1ed2-4db1-8ae6-a62ac4897b98 + X-Runtime: + - '0.036615' + X-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_instance.py b/tests/test_instance.py index 3b42c3e..5f451c7 100644 --- a/tests/test_instance.py +++ b/tests/test_instance.py @@ -72,4 +72,6 @@ def test_directory(api): assert isinstance(directory, list) assert len(directory) > 0 - +@pytest.mark.vcr() +def test_instance_rules(api): + assert isinstance(api.instance_rules(), list) -- cgit v1.2.3