aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_admin_accounts_v1.yaml179
-rw-r--r--tests/cassettes/test_admin_accounts_v2.yaml237
-rw-r--r--tests/test_admin.py38
-rw-r--r--tests/test_constructor.py11
4 files changed, 462 insertions, 3 deletions
diff --git a/tests/cassettes/test_admin_accounts_v1.yaml b/tests/cassettes/test_admin_accounts_v1.yaml
new file mode 100644
index 0000000..0c9b187
--- /dev/null
+++ b/tests/cassettes/test_admin_accounts_v1.yaml
@@ -0,0 +1,179 @@
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_2
11 Connection:
12 - keep-alive
13 User-Agent:
14 - tests/v311
15 method: GET
16 uri: http://localhost:3000/api/v1/admin/accounts?active=True
17 response:
18 body:
19 string: '[{"id":"109411886050231694","username":"mastodonpy_test_2","domain":null,"created_at":"2022-11-26T20:01:30.195Z","email":"mastodonpy_test_2@localhost:3000","ip":null,"role":{"id":-99,"name":"","color":"","position":-1,"permissions":65536,"highlighted":false,"created_at":"2022-11-26T20:01:24.328Z","updated_at":"2022-11-26T20:01:24.328Z"},"confirmed":true,"suspended":false,"silenced":false,"sensitized":false,"disabled":false,"approved":true,"locale":"ja","invite_request":null,"ips":[],"account":{"id":"109411886050231694","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}},{"id":"109411885927532888","username":"mastodonpy_test","domain":null,"created_at":"2022-11-26T20:01:28.322Z","email":"mastodonpy_test@localhost:3000","ip":null,"role":{"id":-99,"name":"","color":"","position":-1,"permissions":65536,"highlighted":false,"created_at":"2022-11-26T20:01:24.328Z","updated_at":"2022-11-26T20:01:24.328Z"},"confirmed":true,"suspended":false,"silenced":false,"sensitized":false,"disabled":false,"approved":true,"locale":"ja","invite_request":null,"ips":[],"account":{"id":"109411885927532888","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}},{"id":"109411885799291132","username":"admin2","domain":null,"created_at":"2022-11-26T20:01:26.347Z","email":"[email protected]","ip":"127.0.0.1","role":{"id":3,"name":"Owner","color":"","position":1000,"permissions":1,"highlighted":true,"created_at":"2022-11-26T20:01:24.338Z","updated_at":"2022-11-26T20:01:24.338Z"},"confirmed":true,"suspended":false,"silenced":false,"sensitized":false,"disabled":false,"approved":true,"locale":"de","invite_request":null,"ips":[{"ip":"127.0.0.1","used_at":"2022-11-26T20:02:19.675Z"}],"account":{"id":"109411885799291132","username":"admin2","acct":"admin2","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}},{"id":"109411885671340064","username":"admin","domain":null,"created_at":"2022-11-26T20:01:24.342Z","email":"admin@localhost:3000","ip":null,"role":{"id":3,"name":"Owner","color":"","position":1000,"permissions":1,"highlighted":true,"created_at":"2022-11-26T20:01:24.338Z","updated_at":"2022-11-26T20:01:24.338Z"},"confirmed":true,"suspended":false,"silenced":false,"sensitized":false,"disabled":false,"approved":true,"locale":null,"invite_request":null,"ips":[],"account":{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}}]'
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-rha1g8vCqT8/tDp8mtlrdg=='';
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/"70761e00feb13529509779ca3060705b"
37 Link:
38 - <http://localhost:3000/api/v1/admin/accounts?active=True&min_id=109411886050231694>;
39 rel="prev"
40 Referrer-Policy:
41 - strict-origin-when-cross-origin
42 Transfer-Encoding:
43 - chunked
44 Vary:
45 - Accept, Origin
46 X-Content-Type-Options:
47 - nosniff
48 X-Download-Options:
49 - noopen
50 X-Frame-Options:
51 - SAMEORIGIN
52 X-Permitted-Cross-Domain-Policies:
53 - none
54 X-Request-Id:
55 - 2e6b413e-114f-495b-8e0e-870b11ea4195
56 X-Runtime:
57 - '0.174018'
58 X-XSS-Protection:
59 - 1; mode=block
60 status:
61 code: 200
62 message: OK
63- request:
64 body: null
65 headers:
66 Accept:
67 - '*/*'
68 Accept-Encoding:
69 - gzip, deflate
70 Authorization:
71 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
72 Connection:
73 - keep-alive
74 User-Agent:
75 - tests/v311
76 method: GET
77 uri: http://localhost:3000/api/v1/accounts/verify_credentials
78 response:
79 body:
80 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
81 headers:
82 Cache-Control:
83 - no-store
84 Content-Security-Policy:
85 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
86 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
87 style-src ''self'' http://localhost:3000 ''nonce-SRfegda7FJ4bXLLndhYA9g=='';
88 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
89 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
90 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
91 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
92 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
93 worker-src ''self'' blob: http://localhost:3000'
94 Content-Type:
95 - application/json; charset=utf-8
96 ETag:
97 - W/"a92dcb08b6f874d680c45eede3cca2ec"
98 Referrer-Policy:
99 - strict-origin-when-cross-origin
100 Transfer-Encoding:
101 - chunked
102 Vary:
103 - Accept, Origin
104 X-Content-Type-Options:
105 - nosniff
106 X-Download-Options:
107 - noopen
108 X-Frame-Options:
109 - SAMEORIGIN
110 X-Permitted-Cross-Domain-Policies:
111 - none
112 X-Request-Id:
113 - 5b1a9983-a201-4b01-8279-4f24d394cde0
114 X-Runtime:
115 - '0.019987'
116 X-XSS-Protection:
117 - 1; mode=block
118 status:
119 code: 200
120 message: OK
121- request:
122 body: null
123 headers:
124 Accept:
125 - '*/*'
126 Accept-Encoding:
127 - gzip, deflate
128 Authorization:
129 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
130 Connection:
131 - keep-alive
132 User-Agent:
133 - tests/v311
134 method: GET
135 uri: http://localhost:3000/api/v1/admin/accounts/109411885671340064
136 response:
137 body:
138 string: '{"id":"109411885671340064","username":"admin","domain":null,"created_at":"2022-11-26T20:01:24.342Z","email":"admin@localhost:3000","ip":null,"role":{"id":3,"name":"Owner","color":"","position":1000,"permissions":1,"highlighted":true,"created_at":"2022-11-26T20:01:24.338Z","updated_at":"2022-11-26T20:01:24.338Z"},"confirmed":true,"suspended":false,"silenced":false,"sensitized":false,"disabled":false,"approved":true,"locale":null,"invite_request":null,"ips":[],"account":{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}}'
139 headers:
140 Cache-Control:
141 - no-store
142 Content-Security-Policy:
143 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
144 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
145 style-src ''self'' http://localhost:3000 ''nonce-Xr1816+FDipTuvfoqQHZ2A=='';
146 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
147 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
148 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
149 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
150 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
151 worker-src ''self'' blob: http://localhost:3000'
152 Content-Type:
153 - application/json; charset=utf-8
154 ETag:
155 - W/"7fabd2598ffb35064504f9e5215e21e6"
156 Referrer-Policy:
157 - strict-origin-when-cross-origin
158 Transfer-Encoding:
159 - chunked
160 Vary:
161 - Accept, Origin
162 X-Content-Type-Options:
163 - nosniff
164 X-Download-Options:
165 - noopen
166 X-Frame-Options:
167 - SAMEORIGIN
168 X-Permitted-Cross-Domain-Policies:
169 - none
170 X-Request-Id:
171 - eec919d4-f033-4d8a-a74c-b7c5f9f82df2
172 X-Runtime:
173 - '0.020002'
174 X-XSS-Protection:
175 - 1; mode=block
176 status:
177 code: 200
178 message: OK
179version: 1
diff --git a/tests/cassettes/test_admin_accounts_v2.yaml b/tests/cassettes/test_admin_accounts_v2.yaml
new file mode 100644
index 0000000..5b5e041
--- /dev/null
+++ b/tests/cassettes/test_admin_accounts_v2.yaml
@@ -0,0 +1,237 @@
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_2
11 Connection:
12 - keep-alive
13 User-Agent:
14 - tests/v311
15 method: GET
16 uri: http://localhost:3000/api/v2/admin/accounts?origin=local&permissions=staff
17 response:
18 body:
19 string: '[{"id":"109411885799291132","username":"admin2","domain":null,"created_at":"2022-11-26T20:01:26.347Z","email":"[email protected]","ip":"127.0.0.1","role":{"id":3,"name":"Owner","color":"","position":1000,"permissions":1,"highlighted":true,"created_at":"2022-11-26T20:01:24.338Z","updated_at":"2022-11-26T20:01:24.338Z"},"confirmed":true,"suspended":false,"silenced":false,"sensitized":false,"disabled":false,"approved":true,"locale":"de","invite_request":null,"ips":[{"ip":"127.0.0.1","used_at":"2022-11-26T20:02:19.675Z"}],"account":{"id":"109411885799291132","username":"admin2","acct":"admin2","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}},{"id":"109411885671340064","username":"admin","domain":null,"created_at":"2022-11-26T20:01:24.342Z","email":"admin@localhost:3000","ip":null,"role":{"id":3,"name":"Owner","color":"","position":1000,"permissions":1,"highlighted":true,"created_at":"2022-11-26T20:01:24.338Z","updated_at":"2022-11-26T20:01:24.338Z"},"confirmed":true,"suspended":false,"silenced":false,"sensitized":false,"disabled":false,"approved":true,"locale":null,"invite_request":null,"ips":[],"account":{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}}]'
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-i6KQJf/pTUkNc5Iqg28llQ=='';
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/"4ad52a55c7bd828f38a03190a044caff"
37 Link:
38 - <http://localhost:3000/api/v1/admin/accounts?min_id=109411885799291132&origin=local&permissions=staff>;
39 rel="prev"
40 Referrer-Policy:
41 - strict-origin-when-cross-origin
42 Transfer-Encoding:
43 - chunked
44 Vary:
45 - Accept, Origin
46 X-Content-Type-Options:
47 - nosniff
48 X-Download-Options:
49 - noopen
50 X-Frame-Options:
51 - SAMEORIGIN
52 X-Permitted-Cross-Domain-Policies:
53 - none
54 X-Request-Id:
55 - 67ac51e6-39dd-4859-896c-db8daa32e970
56 X-Runtime:
57 - '0.031220'
58 X-XSS-Protection:
59 - 1; mode=block
60 status:
61 code: 200
62 message: OK
63- request:
64 body: null
65 headers:
66 Accept:
67 - '*/*'
68 Accept-Encoding:
69 - gzip, deflate
70 Authorization:
71 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
72 Connection:
73 - keep-alive
74 User-Agent:
75 - tests/v311
76 method: GET
77 uri: http://localhost:3000/api/v1/accounts/verify_credentials
78 response:
79 body:
80 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
81 headers:
82 Cache-Control:
83 - no-store
84 Content-Security-Policy:
85 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
86 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
87 style-src ''self'' http://localhost:3000 ''nonce-4FwT6Ya41GHCR7ZSi+el3A=='';
88 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
89 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
90 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
91 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
92 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
93 worker-src ''self'' blob: http://localhost:3000'
94 Content-Type:
95 - application/json; charset=utf-8
96 ETag:
97 - W/"a92dcb08b6f874d680c45eede3cca2ec"
98 Referrer-Policy:
99 - strict-origin-when-cross-origin
100 Transfer-Encoding:
101 - chunked
102 Vary:
103 - Accept, Origin
104 X-Content-Type-Options:
105 - nosniff
106 X-Download-Options:
107 - noopen
108 X-Frame-Options:
109 - SAMEORIGIN
110 X-Permitted-Cross-Domain-Policies:
111 - none
112 X-Request-Id:
113 - f5d704f6-5e3b-4438-b406-5dea67ed9a86
114 X-Runtime:
115 - '0.016054'
116 X-XSS-Protection:
117 - 1; mode=block
118 status:
119 code: 200
120 message: OK
121- request:
122 body: null
123 headers:
124 Accept:
125 - '*/*'
126 Accept-Encoding:
127 - gzip, deflate
128 Authorization:
129 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
130 Connection:
131 - keep-alive
132 User-Agent:
133 - tests/v311
134 method: GET
135 uri: http://localhost:3000/api/v1/admin/accounts/109411885671340064
136 response:
137 body:
138 string: '{"id":"109411885671340064","username":"admin","domain":null,"created_at":"2022-11-26T20:01:24.342Z","email":"admin@localhost:3000","ip":null,"role":{"id":3,"name":"Owner","color":"","position":1000,"permissions":1,"highlighted":true,"created_at":"2022-11-26T20:01:24.338Z","updated_at":"2022-11-26T20:01:24.338Z"},"confirmed":true,"suspended":false,"silenced":false,"sensitized":false,"disabled":false,"approved":true,"locale":null,"invite_request":null,"ips":[],"account":{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}}'
139 headers:
140 Cache-Control:
141 - no-store
142 Content-Security-Policy:
143 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
144 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
145 style-src ''self'' http://localhost:3000 ''nonce-7x8Gs/Uz7sVtsdZvlOnFsQ=='';
146 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
147 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
148 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
149 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
150 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
151 worker-src ''self'' blob: http://localhost:3000'
152 Content-Type:
153 - application/json; charset=utf-8
154 ETag:
155 - W/"7fabd2598ffb35064504f9e5215e21e6"
156 Referrer-Policy:
157 - strict-origin-when-cross-origin
158 Transfer-Encoding:
159 - chunked
160 Vary:
161 - Accept, Origin
162 X-Content-Type-Options:
163 - nosniff
164 X-Download-Options:
165 - noopen
166 X-Frame-Options:
167 - SAMEORIGIN
168 X-Permitted-Cross-Domain-Policies:
169 - none
170 X-Request-Id:
171 - 86e6959f-0c1d-4f6c-840d-59619a50a4cd
172 X-Runtime:
173 - '0.016896'
174 X-XSS-Protection:
175 - 1; mode=block
176 status:
177 code: 200
178 message: OK
179- request:
180 body: null
181 headers:
182 Accept:
183 - '*/*'
184 Accept-Encoding:
185 - gzip, deflate
186 Authorization:
187 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
188 Connection:
189 - keep-alive
190 User-Agent:
191 - tests/v311
192 method: GET
193 uri: http://localhost:3000/api/v2/admin/accounts?origin=remote&permissions=staff
194 response:
195 body:
196 string: '[]'
197 headers:
198 Cache-Control:
199 - no-store
200 Content-Security-Policy:
201 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
202 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
203 style-src ''self'' http://localhost:3000 ''nonce-deIQ40i1Hr9YZswIHlu1Wg=='';
204 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
205 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
206 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
207 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
208 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
209 worker-src ''self'' blob: http://localhost:3000'
210 Content-Type:
211 - application/json; charset=utf-8
212 ETag:
213 - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5"
214 Referrer-Policy:
215 - strict-origin-when-cross-origin
216 Transfer-Encoding:
217 - chunked
218 Vary:
219 - Accept, Origin
220 X-Content-Type-Options:
221 - nosniff
222 X-Download-Options:
223 - noopen
224 X-Frame-Options:
225 - SAMEORIGIN
226 X-Permitted-Cross-Domain-Policies:
227 - none
228 X-Request-Id:
229 - b0b0702f-c15a-4d39-9996-a2c4c2ad5a6f
230 X-Runtime:
231 - '0.016651'
232 X-XSS-Protection:
233 - 1; mode=block
234 status:
235 code: 200
236 message: OK
237version: 1
diff --git a/tests/test_admin.py b/tests/test_admin.py
index d937ed8..b0716e5 100644
--- a/tests/test_admin.py
+++ b/tests/test_admin.py
@@ -16,6 +16,44 @@ def test_admin_accounts(api2):
16 assert(account_admin) 16 assert(account_admin)
17 assert(account_admin.id == account_self.id) 17 assert(account_admin.id == account_self.id)
18 18
19@pytest.mark.vcr()
20def test_admin_accounts_v1(api2):
21 accounts = api2.admin_accounts_v1()
22
23 assert accounts
24 assert len(accounts) > 0
25
26 account_self = api2.account_verify_credentials()
27 account_admin = api2.admin_account(account_self)
28
29 assert(account_admin)
30 assert(account_admin.id == account_self.id)
31
32@pytest.mark.vcr()
33def test_admin_accounts_v2(api2):
34 accounts = api2.admin_accounts_v2(permissions="staff", origin="local")
35
36 assert accounts
37 assert len(accounts) > 0
38
39 account_self = api2.account_verify_credentials()
40 account_admin = api2.admin_account(account_self)
41
42 assert(account_admin)
43 assert(account_admin.id == account_self.id)
44
45 accounts = api2.admin_accounts_v2(permissions="staff", origin="remote")
46 assert len(accounts) == 0
47
48 with pytest.raises(MastodonIllegalArgumentError):
49 accounts = api2.admin_accounts_v2(permissions="stave")
50
51 with pytest.raises(MastodonIllegalArgumentError):
52 accounts = api2.admin_accounts_v2(origin="global")
53
54 with pytest.raises(MastodonIllegalArgumentError):
55 accounts = api2.admin_accounts_v2(status="sick")
56
19@pytest.mark.vcr(match_on=['path']) 57@pytest.mark.vcr(match_on=['path'])
20def test_admin_moderation(api, api2): 58def test_admin_moderation(api, api2):
21 account_initial = api.account_verify_credentials() 59 account_initial = api.account_verify_credentials()
diff --git a/tests/test_constructor.py b/tests/test_constructor.py
index ed38b9c..2531e19 100644
--- a/tests/test_constructor.py
+++ b/tests/test_constructor.py
@@ -18,9 +18,14 @@ def test_constructor_from_filenames(tmpdir):
18 18
19def test_constructor_illegal_ratelimit(): 19def test_constructor_illegal_ratelimit():
20 with pytest.raises(MastodonIllegalArgumentError): 20 with pytest.raises(MastodonIllegalArgumentError):
21 api = Mastodon( 21 api = Mastodon('foo', client_secret='bar', ratelimit_method='baz', api_base_url="whatever")
22 'foo', client_secret='bar', 22
23 ratelimit_method='baz') 23def test_constructor_no_url():
24 with pytest.raises(MastodonIllegalArgumentError):
25 api = Mastodon('foo', client_secret='bar')
26
27 with pytest.raises(MastodonIllegalArgumentError):
28 api = Mastodon(access_token='baz')
24 29
25def test_constructor_illegal_versioncheckmode(): 30def test_constructor_illegal_versioncheckmode():
26 with pytest.raises(MastodonIllegalArgumentError): 31 with pytest.raises(MastodonIllegalArgumentError):
Powered by cgit v1.2.3 (git 2.41.0)