diff options
author | codl <[email protected]> | 2017-11-30 01:29:20 +0100 |
---|---|---|
committer | codl <[email protected]> | 2017-11-30 01:29:20 +0100 |
commit | 2b4008981055f990c23bf42bb65f856231436422 (patch) | |
tree | 6638583244b7e8b288655bc7f74f4147a5e8d655 | |
parent | f9a52029fc6d399c8fcd85a50060e0f5773da78e (diff) | |
download | mastodon.py-2b4008981055f990c23bf42bb65f856231436422.tar.gz |
add tests for domain block methods
-rw-r--r-- | tests/cassettes/test_domain_block_unblock.yaml | 56 | ||||
-rw-r--r-- | tests/cassettes/test_domain_blocks.yaml | 27 | ||||
-rw-r--r-- | tests/test_domain_blocks.py | 13 |
3 files changed, 96 insertions, 0 deletions
diff --git a/tests/cassettes/test_domain_block_unblock.yaml b/tests/cassettes/test_domain_block_unblock.yaml new file mode 100644 index 0000000..e60b12b --- /dev/null +++ b/tests/cassettes/test_domain_block_unblock.yaml | |||
@@ -0,0 +1,56 @@ | |||
1 | interactions: | ||
2 | - request: | ||
3 | body: domain=example.com | ||
4 | headers: | ||
5 | Accept: ['*/*'] | ||
6 | Accept-Encoding: ['gzip, deflate'] | ||
7 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
8 | Connection: [keep-alive] | ||
9 | Content-Length: ['18'] | ||
10 | Content-Type: [application/x-www-form-urlencoded] | ||
11 | User-Agent: [python-requests/2.18.4] | ||
12 | method: POST | ||
13 | uri: http://localhost:3000/api/v1/domain_blocks | ||
14 | response: | ||
15 | body: {string: '{}'} | ||
16 | headers: | ||
17 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
18 | Content-Type: [application/json; charset=utf-8] | ||
19 | ETag: [W/"fe7f6d5b13e22f37fb57de6e31e0ef11"] | ||
20 | Transfer-Encoding: [chunked] | ||
21 | Vary: ['Accept-Encoding, Origin'] | ||
22 | X-Content-Type-Options: [nosniff] | ||
23 | X-Frame-Options: [SAMEORIGIN] | ||
24 | X-Request-Id: [cb5c8333-c6bd-41c3-bdfd-d6c974ea7d2b] | ||
25 | X-Runtime: ['0.059619'] | ||
26 | X-XSS-Protection: [1; mode=block] | ||
27 | content-length: ['2'] | ||
28 | status: {code: 200, message: OK} | ||
29 | - request: | ||
30 | body: domain=example.com | ||
31 | headers: | ||
32 | Accept: ['*/*'] | ||
33 | Accept-Encoding: ['gzip, deflate'] | ||
34 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
35 | Connection: [keep-alive] | ||
36 | Content-Length: ['18'] | ||
37 | Content-Type: [application/x-www-form-urlencoded] | ||
38 | User-Agent: [python-requests/2.18.4] | ||
39 | method: DELETE | ||
40 | uri: http://localhost:3000/api/v1/domain_blocks | ||
41 | response: | ||
42 | body: {string: '{}'} | ||
43 | headers: | ||
44 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
45 | Content-Type: [application/json; charset=utf-8] | ||
46 | ETag: [W/"fe7f6d5b13e22f37fb57de6e31e0ef11"] | ||
47 | Transfer-Encoding: [chunked] | ||
48 | Vary: ['Accept-Encoding, Origin'] | ||
49 | X-Content-Type-Options: [nosniff] | ||
50 | X-Frame-Options: [SAMEORIGIN] | ||
51 | X-Request-Id: [56395cbf-814c-4e57-97fd-2c44592211aa] | ||
52 | X-Runtime: ['0.019281'] | ||
53 | X-XSS-Protection: [1; mode=block] | ||
54 | content-length: ['2'] | ||
55 | status: {code: 200, message: OK} | ||
56 | version: 1 | ||
diff --git a/tests/cassettes/test_domain_blocks.yaml b/tests/cassettes/test_domain_blocks.yaml new file mode 100644 index 0000000..2af5f05 --- /dev/null +++ b/tests/cassettes/test_domain_blocks.yaml | |||
@@ -0,0 +1,27 @@ | |||
1 | interactions: | ||
2 | - request: | ||
3 | body: null | ||
4 | headers: | ||
5 | Accept: ['*/*'] | ||
6 | Accept-Encoding: ['gzip, deflate'] | ||
7 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
8 | Connection: [keep-alive] | ||
9 | User-Agent: [python-requests/2.18.4] | ||
10 | method: GET | ||
11 | uri: http://localhost:3000/api/v1/domain_blocks | ||
12 | response: | ||
13 | body: {string: '[]'} | ||
14 | headers: | ||
15 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
16 | Content-Type: [application/json; charset=utf-8] | ||
17 | ETag: [W/"4fdefc2aac1c40f3865259d9f3074aec"] | ||
18 | Transfer-Encoding: [chunked] | ||
19 | Vary: ['Accept-Encoding, Origin'] | ||
20 | X-Content-Type-Options: [nosniff] | ||
21 | X-Frame-Options: [SAMEORIGIN] | ||
22 | X-Request-Id: [d7fec252-2898-46a1-a538-0e5ecda88fa8] | ||
23 | X-Runtime: ['0.032291'] | ||
24 | X-XSS-Protection: [1; mode=block] | ||
25 | content-length: ['2'] | ||
26 | status: {code: 200, message: OK} | ||
27 | version: 1 | ||
diff --git a/tests/test_domain_blocks.py b/tests/test_domain_blocks.py new file mode 100644 index 0000000..c96f7d6 --- /dev/null +++ b/tests/test_domain_blocks.py | |||
@@ -0,0 +1,13 @@ | |||
1 | import pytest | ||
2 | |||
3 | |||
4 | @pytest.mark.vcr() | ||
5 | def test_domain_blocks(api): | ||
6 | blocks = api.domain_blocks() | ||
7 | assert isinstance(blocks, list) | ||
8 | |||
9 | |||
10 | @pytest.mark.vcr() | ||
11 | def test_domain_block_unblock(api): | ||
12 | api.domain_block('example.com') | ||
13 | api.domain_unblock('example.com') | ||