aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_trending_links.yaml (renamed from tests/cassettes/test_trends.yaml)8
-rw-r--r--tests/cassettes/test_trending_statuses.yaml60
-rw-r--r--tests/cassettes/test_trending_tags.yaml118
-rw-r--r--tests/test_instance.py4
-rw-r--r--tests/test_trends.py21
5 files changed, 203 insertions, 8 deletions
diff --git a/tests/cassettes/test_trends.yaml b/tests/cassettes/test_trending_links.yaml
index 41cf4af..3d54b25 100644
--- a/tests/cassettes/test_trends.yaml
+++ b/tests/cassettes/test_trending_links.yaml
@@ -13,7 +13,7 @@ interactions:
13 User-Agent: 13 User-Agent:
14 - tests/v311 14 - tests/v311
15 method: GET 15 method: GET
16 uri: http://localhost:3000/api/v1/trends 16 uri: http://localhost:3000/api/v1/trends/links
17 response: 17 response:
18 body: 18 body:
19 string: '[]' 19 string: '[]'
@@ -23,7 +23,7 @@ interactions:
23 Content-Security-Policy: 23 Content-Security-Policy:
24 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src 24 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
25 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; 25 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
26 style-src ''self'' http://localhost:3000 ''nonce-wweJU6CNiZOq8p6GOgvKMg==''; 26 style-src ''self'' http://localhost:3000 ''nonce-7UiLUEyJEVY9JgarYKBdCg=='';
27 media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' 27 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
28 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' 28 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
29 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 29 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
@@ -49,9 +49,9 @@ interactions:
49 X-Permitted-Cross-Domain-Policies: 49 X-Permitted-Cross-Domain-Policies:
50 - none 50 - none
51 X-Request-Id: 51 X-Request-Id:
52 - 04d49bc9-1ad7-48de-a189-e93e527942e0 52 - 623f9c94-2540-4c4f-b0ae-1c3db0b9ca35
53 X-Runtime: 53 X-Runtime:
54 - '0.010606' 54 - '0.016081'
55 X-XSS-Protection: 55 X-XSS-Protection:
56 - 1; mode=block 56 - 1; mode=block
57 status: 57 status:
diff --git a/tests/cassettes/test_trending_statuses.yaml b/tests/cassettes/test_trending_statuses.yaml
new file mode 100644
index 0000000..493555d
--- /dev/null
+++ b/tests/cassettes/test_trending_statuses.yaml
@@ -0,0 +1,60 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept:
6 - '*/*'
7 Accept-Encoding:
8 - gzip, deflate
9 Authorization:
10 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
11 Connection:
12 - keep-alive
13 User-Agent:
14 - tests/v311
15 method: GET
16 uri: http://localhost:3000/api/v1/trends/statuses
17 response:
18 body:
19 string: '[]'
20 headers:
21 Cache-Control:
22 - no-store
23 Content-Security-Policy:
24 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
25 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
26 style-src ''self'' http://localhost:3000 ''nonce-Qp9U6bbMsEloa3BOJP+ApA=='';
27 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
28 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
29 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
30 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
31 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
32 worker-src ''self'' blob: http://localhost:3000'
33 Content-Type:
34 - application/json; charset=utf-8
35 ETag:
36 - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5"
37 Referrer-Policy:
38 - strict-origin-when-cross-origin
39 Transfer-Encoding:
40 - chunked
41 Vary:
42 - Accept, Origin
43 X-Content-Type-Options:
44 - nosniff
45 X-Download-Options:
46 - noopen
47 X-Frame-Options:
48 - SAMEORIGIN
49 X-Permitted-Cross-Domain-Policies:
50 - none
51 X-Request-Id:
52 - 9b65a082-dbab-436e-9544-9d3ceae169b0
53 X-Runtime:
54 - '0.022649'
55 X-XSS-Protection:
56 - 1; mode=block
57 status:
58 code: 200
59 message: OK
60version: 1
diff --git a/tests/cassettes/test_trending_tags.yaml b/tests/cassettes/test_trending_tags.yaml
new file mode 100644
index 0000000..583aeda
--- /dev/null
+++ b/tests/cassettes/test_trending_tags.yaml
@@ -0,0 +1,118 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept:
6 - '*/*'
7 Accept-Encoding:
8 - gzip, deflate
9 Authorization:
10 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
11 Connection:
12 - keep-alive
13 User-Agent:
14 - tests/v311
15 method: GET
16 uri: http://localhost:3000/api/v1/trends/tags
17 response:
18 body:
19 string: '[]'
20 headers:
21 Cache-Control:
22 - no-store
23 Content-Security-Policy:
24 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
25 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
26 style-src ''self'' http://localhost:3000 ''nonce-x84HIusoB0oMG/yq6Q4NDg=='';
27 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
28 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
29 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
30 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
31 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
32 worker-src ''self'' blob: http://localhost:3000'
33 Content-Type:
34 - application/json; charset=utf-8
35 ETag:
36 - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5"
37 Referrer-Policy:
38 - strict-origin-when-cross-origin
39 Transfer-Encoding:
40 - chunked
41 Vary:
42 - Accept, Origin
43 X-Content-Type-Options:
44 - nosniff
45 X-Download-Options:
46 - noopen
47 X-Frame-Options:
48 - SAMEORIGIN
49 X-Permitted-Cross-Domain-Policies:
50 - none
51 X-Request-Id:
52 - e26034bb-bfdb-4f3a-bbef-9d2e51f88c14
53 X-Runtime:
54 - '0.029510'
55 X-XSS-Protection:
56 - 1; mode=block
57 status:
58 code: 200
59 message: OK
60- request:
61 body: null
62 headers:
63 Accept:
64 - '*/*'
65 Accept-Encoding:
66 - gzip, deflate
67 Authorization:
68 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
69 Connection:
70 - keep-alive
71 User-Agent:
72 - tests/v311
73 method: GET
74 uri: http://localhost:3000/api/v1/trends/tags
75 response:
76 body:
77 string: '[]'
78 headers:
79 Cache-Control:
80 - no-store
81 Content-Security-Policy:
82 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
83 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
84 style-src ''self'' http://localhost:3000 ''nonce-mRWh2zKUzi/z+WYqVSZD1g=='';
85 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
86 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
87 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
88 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
89 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
90 worker-src ''self'' blob: http://localhost:3000'
91 Content-Type:
92 - application/json; charset=utf-8
93 ETag:
94 - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5"
95 Referrer-Policy:
96 - strict-origin-when-cross-origin
97 Transfer-Encoding:
98 - chunked
99 Vary:
100 - Accept, Origin
101 X-Content-Type-Options:
102 - nosniff
103 X-Download-Options:
104 - noopen
105 X-Frame-Options:
106 - SAMEORIGIN
107 X-Permitted-Cross-Domain-Policies:
108 - none
109 X-Request-Id:
110 - c1cc20bc-a0b0-4ffa-bd72-686a094e1da0
111 X-Runtime:
112 - '0.015007'
113 X-XSS-Protection:
114 - 1; mode=block
115 status:
116 code: 200
117 message: OK
118version: 1
diff --git a/tests/test_instance.py b/tests/test_instance.py
index e25a686..99a3534 100644
--- a/tests/test_instance.py
+++ b/tests/test_instance.py
@@ -63,10 +63,6 @@ def test_nodeinfo(api):
63 assert nodeinfo.version == '2.0' 63 assert nodeinfo.version == '2.0'
64 64
65@pytest.mark.vcr() 65@pytest.mark.vcr()
66def test_trends(api):
67 assert isinstance(api.trends(), list)
68
69@pytest.mark.vcr()
70def test_directory(api): 66def test_directory(api):
71 directory = api.directory() 67 directory = api.directory()
72 assert directory 68 assert directory
diff --git a/tests/test_trends.py b/tests/test_trends.py
new file mode 100644
index 0000000..67599d2
--- /dev/null
+++ b/tests/test_trends.py
@@ -0,0 +1,21 @@
1import pytest
2import time
3import vcr
4
5
6@pytest.mark.vcr()
7def test_trending_tags(api):
8 tags = api.trending_tags()
9 assert isinstance(tags, list)
10 tags = api.trends()
11 assert isinstance(tags, list)
12
13@pytest.mark.vcr()
14def test_trending_statuses(api):
15 statuses = api.trending_statuses()
16 assert isinstance(statuses, list)
17
18@pytest.mark.vcr()
19def test_trending_links(api):
20 links = api.trending_links()
21 assert isinstance(links, list)
Powered by cgit v1.2.3 (git 2.41.0)