aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-19 01:11:02 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-19 01:11:02 +0200
commitf2282790cc7e980bba96cdadde2ab8b6af3e6095 (patch)
tree5677af23a8a04c7a5c36c4fb02fd1e23642601e8 /tests
parent6a630202db718c5ed2924ad3a3863d7eee391b88 (diff)
downloadmastodon.py-f2282790cc7e980bba96cdadde2ab8b6af3e6095.tar.gz
Add email resend api
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_app_account_create.yaml112
-rw-r--r--tests/test_create_app.py7
2 files changed, 92 insertions, 27 deletions
diff --git a/tests/cassettes/test_app_account_create.yaml b/tests/cassettes/test_app_account_create.yaml
index 8f7f664..33c6723 100644
--- a/tests/cassettes/test_app_account_create.yaml
+++ b/tests/cassettes/test_app_account_create.yaml
@@ -18,14 +18,14 @@ interactions:
18 uri: http://localhost:3000/api/v1/apps 18 uri: http://localhost:3000/api/v1/apps
19 response: 19 response:
20 body: 20 body:
21 string: '{"id":"2","name":"mastodon.py generated test app","website":null,"redirect_uri":"urn:ietf:wg:oauth:2.0:oob","client_id":"gEuKqNuywsaMneO5Ac2jiOwyIxDfAl8vCAEQHQroDEA","client_secret":"WU0JXbe9t289_sIhrlD_m2rTJZWcehTNy60Khq1hFSs","vapid_key":"BIX7IY8wYrdPf5wfG59B5B4CBbpQWmOBr_SI9zEsCDfMGDx8KmPuu-3WP7b-amaekv2NZj3ZSNst9OaqoxXvC1s="}' 21 string: '{"id":"3","name":"mastodon.py generated test app","website":null,"redirect_uri":"urn:ietf:wg:oauth:2.0:oob","client_id":"i5IaOmWav2cZA-GOJt-F2VfATkknbX0R8quGGBpwcTA","client_secret":"MUZ-dt5iJqQZdEug7rSH2L76dWfmbZAiA63n8je_QSg","vapid_key":"BFu6DBpfcm8_h8gm3rHUkfaOLg7azvYN_auFI4KcNuh5SLBVMhTkKKvUaLENtA_c6v5Hmrucvh0WwsN1o9NFQRU="}'
22 headers: 22 headers:
23 Cache-Control: 23 Cache-Control:
24 - no-store 24 - no-store
25 Content-Security-Policy: 25 Content-Security-Policy:
26 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src 26 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
27 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; 27 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
28 style-src ''self'' http://localhost:3000 ''nonce-Zh318FJnptQQXbYGbr6ipQ==''; 28 style-src ''self'' http://localhost:3000 ''nonce-PMQM0qLu5SRYCvXeJZ0kQg=='';
29 media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' 29 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
30 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' 30 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
31 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 31 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
@@ -35,7 +35,7 @@ interactions:
35 Content-Type: 35 Content-Type:
36 - application/json; charset=utf-8 36 - application/json; charset=utf-8
37 ETag: 37 ETag:
38 - W/"4ce1f03f00fba44db374be39a911d5c7" 38 - W/"6d8fcc5bda56fba5337c6b58a9043b2e"
39 Referrer-Policy: 39 Referrer-Policy:
40 - strict-origin-when-cross-origin 40 - strict-origin-when-cross-origin
41 Transfer-Encoding: 41 Transfer-Encoding:
@@ -51,9 +51,9 @@ interactions:
51 X-Permitted-Cross-Domain-Policies: 51 X-Permitted-Cross-Domain-Policies:
52 - none 52 - none
53 X-Request-Id: 53 X-Request-Id:
54 - 13df349b-78e3-4af3-8362-2036891efa2c 54 - 32de1904-3319-4b4a-9596-acf1e5ba291c
55 X-Runtime: 55 X-Runtime:
56 - '0.013468' 56 - '0.024619'
57 X-XSS-Protection: 57 X-XSS-Protection:
58 - 1; mode=block 58 - 1; mode=block
59 status: 59 status:
@@ -74,14 +74,14 @@ interactions:
74 uri: http://localhost:3000/api/v1/instance/ 74 uri: http://localhost:3000/api/v1/instance/
75 response: 75 response:
76 body: 76 body:
77 string: '{"uri":"localhost:3000","title":"Mastodon","short_description":"","description":"","email":"","version":"4.0.0rc2","urls":{"streaming_api":"ws://localhost:4000"},"stats":{"user_count":4,"status_count":1,"domain_count":0},"thumbnail":"http://localhost:3000/packs/media/images/preview-6399aebd96ccf025654e2977454f168f.png","languages":["en"],"registrations":true,"approval_required":false,"invites_enabled":true,"configuration":{"accounts":{"max_featured_tags":10},"statuses":{"max_characters":500,"max_media_attachments":4,"characters_reserved_per_url":23},"media_attachments":{"supported_mime_types":["image/jpeg","image/png","image/gif","image/heic","image/heif","image/webp","image/avif","video/webm","video/mp4","video/quicktime","video/ogg","audio/wave","audio/wav","audio/x-wav","audio/x-pn-wave","audio/vnd.wave","audio/ogg","audio/vorbis","audio/mpeg","audio/mp3","audio/webm","audio/flac","audio/aac","audio/m4a","audio/x-m4a","audio/mp4","audio/3gpp","video/x-ms-asf"],"image_size_limit":10485760,"image_matrix_limit":16777216,"video_size_limit":41943040,"video_frame_rate_limit":60,"video_matrix_limit":2304000},"polls":{"max_options":4,"max_characters_per_option":50,"min_expiration":300,"max_expiration":2629746}},"contact_account":null,"rules":[]}' 77 string: '{"uri":"localhost:3000","title":"Mastodon","short_description":"","description":"","email":"","version":"4.0.0rc2","urls":{"streaming_api":"ws://localhost:4000"},"stats":{"user_count":4,"status_count":5,"domain_count":0},"thumbnail":"http://localhost:3000/packs/media/images/preview-6399aebd96ccf025654e2977454f168f.png","languages":["en"],"registrations":true,"approval_required":false,"invites_enabled":true,"configuration":{"accounts":{"max_featured_tags":10},"statuses":{"max_characters":500,"max_media_attachments":4,"characters_reserved_per_url":23},"media_attachments":{"supported_mime_types":["image/jpeg","image/png","image/gif","image/heic","image/heif","image/webp","image/avif","video/webm","video/mp4","video/quicktime","video/ogg","audio/wave","audio/wav","audio/x-wav","audio/x-pn-wave","audio/vnd.wave","audio/ogg","audio/vorbis","audio/mpeg","audio/mp3","audio/webm","audio/flac","audio/aac","audio/m4a","audio/x-m4a","audio/mp4","audio/3gpp","video/x-ms-asf"],"image_size_limit":10485760,"image_matrix_limit":16777216,"video_size_limit":41943040,"video_frame_rate_limit":60,"video_matrix_limit":2304000},"polls":{"max_options":4,"max_characters_per_option":50,"min_expiration":300,"max_expiration":2629746}},"contact_account":null,"rules":[]}'
78 headers: 78 headers:
79 Cache-Control: 79 Cache-Control:
80 - max-age=180, public 80 - max-age=180, public
81 Content-Security-Policy: 81 Content-Security-Policy:
82 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src 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; 83 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
84 style-src ''self'' http://localhost:3000 ''nonce-W66NplWHcyKqASWNg0Dssg==''; 84 style-src ''self'' http://localhost:3000 ''nonce-kSKGlm6hIJpevnUBOkuw6A=='';
85 media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' 85 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
86 https:; manifest-src ''self'' http://localhost:3000; connect-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 87 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
@@ -91,9 +91,9 @@ interactions:
91 Content-Type: 91 Content-Type:
92 - application/json; charset=utf-8 92 - application/json; charset=utf-8
93 Date: 93 Date:
94 - Sun, 13 Nov 2022 16:29:56 GMT 94 - Fri, 18 Nov 2022 23:10:30 GMT
95 ETag: 95 ETag:
96 - W/"bf317ffab393d8d1da7195269f28968a" 96 - W/"58e74f5c697f043d86089eae87509b84"
97 Referrer-Policy: 97 Referrer-Policy:
98 - strict-origin-when-cross-origin 98 - strict-origin-when-cross-origin
99 Transfer-Encoding: 99 Transfer-Encoding:
@@ -109,16 +109,16 @@ interactions:
109 X-Permitted-Cross-Domain-Policies: 109 X-Permitted-Cross-Domain-Policies:
110 - none 110 - none
111 X-Request-Id: 111 X-Request-Id:
112 - 0f6df9ea-ef58-4b94-a0b5-5a41cc140ea4 112 - afd24d44-eaee-493a-802e-647a4e9e6f9a
113 X-Runtime: 113 X-Runtime:
114 - '0.012362' 114 - '0.022642'
115 X-XSS-Protection: 115 X-XSS-Protection:
116 - 1; mode=block 116 - 1; mode=block
117 status: 117 status:
118 code: 200 118 code: 200
119 message: OK 119 message: OK
120- request: 120- request:
121 body: scope=read+write+follow+push&client_id=gEuKqNuywsaMneO5Ac2jiOwyIxDfAl8vCAEQHQroDEA&client_secret=WU0JXbe9t289_sIhrlD_m2rTJZWcehTNy60Khq1hFSs&grant_type=client_credentials 121 body: scope=read+write+follow+push&client_id=i5IaOmWav2cZA-GOJt-F2VfATkknbX0R8quGGBpwcTA&client_secret=MUZ-dt5iJqQZdEug7rSH2L76dWfmbZAiA63n8je_QSg&grant_type=client_credentials
122 headers: 122 headers:
123 Accept: 123 Accept:
124 - '*/*' 124 - '*/*'
@@ -136,15 +136,15 @@ interactions:
136 uri: http://localhost:3000/oauth/token 136 uri: http://localhost:3000/oauth/token
137 response: 137 response:
138 body: 138 body:
139 string: '{"access_token":"hjO121FQ7LARVj6rPCGwBB5ae9q9Qw3qNvJYwKfLIEo","token_type":"Bearer","scope":"read 139 string: '{"access_token":"6w7d8CApoQtnKPZ_XX7vr3X68OLc4RZevnzOfopsxU4","token_type":"Bearer","scope":"read
140 write follow push","created_at":1668356996}' 140 write follow push","created_at":1668813030}'
141 headers: 141 headers:
142 Cache-Control: 142 Cache-Control:
143 - no-store 143 - no-store
144 Content-Security-Policy: 144 Content-Security-Policy:
145 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src 145 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
146 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; 146 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
147 style-src ''self'' http://localhost:3000 ''nonce-Ky+xWz4IzT8eC/nLsYn9Ug==''; 147 style-src ''self'' http://localhost:3000 ''nonce-qVLiytlopC8F7NDbA+J3XQ=='';
148 media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' 148 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
149 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' 149 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
150 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 150 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
@@ -154,7 +154,7 @@ interactions:
154 Content-Type: 154 Content-Type:
155 - application/json; charset=utf-8 155 - application/json; charset=utf-8
156 ETag: 156 ETag:
157 - W/"365d6ad17841f9fc108d819b6f80d64f" 157 - W/"13d9af143daea000a5ee432a619b9736"
158 Pragma: 158 Pragma:
159 - no-cache 159 - no-cache
160 Referrer-Policy: 160 Referrer-Policy:
@@ -172,23 +172,23 @@ interactions:
172 X-Permitted-Cross-Domain-Policies: 172 X-Permitted-Cross-Domain-Policies:
173 - none 173 - none
174 X-Request-Id: 174 X-Request-Id:
175 - 577d694d-e490-4415-992b-da9da0979864 175 - 41bcf86f-fd9d-458f-83ea-e173eb0e8eee
176 X-Runtime: 176 X-Runtime:
177 - '0.010756' 177 - '0.010786'
178 X-XSS-Protection: 178 X-XSS-Protection:
179 - 1; mode=block 179 - 1; mode=block
180 status: 180 status:
181 code: 200 181 code: 200
182 message: OK 182 message: OK
183- request: 183- request:
184 body: username=coolguy27294&password=swordfish&email=email%40localhost27294&agreement=1&locale=en&client_id=gEuKqNuywsaMneO5Ac2jiOwyIxDfAl8vCAEQHQroDEA&client_secret=WU0JXbe9t289_sIhrlD_m2rTJZWcehTNy60Khq1hFSs 184 body: username=coolguy91663&password=swordfish&email=email%40localhost91663&agreement=1&locale=en&client_id=i5IaOmWav2cZA-GOJt-F2VfATkknbX0R8quGGBpwcTA&client_secret=MUZ-dt5iJqQZdEug7rSH2L76dWfmbZAiA63n8je_QSg
185 headers: 185 headers:
186 Accept: 186 Accept:
187 - '*/*' 187 - '*/*'
188 Accept-Encoding: 188 Accept-Encoding:
189 - gzip, deflate 189 - gzip, deflate
190 Authorization: 190 Authorization:
191 - Bearer hjO121FQ7LARVj6rPCGwBB5ae9q9Qw3qNvJYwKfLIEo 191 - Bearer 6w7d8CApoQtnKPZ_XX7vr3X68OLc4RZevnzOfopsxU4
192 Connection: 192 Connection:
193 - keep-alive 193 - keep-alive
194 Content-Length: 194 Content-Length:
@@ -201,15 +201,15 @@ interactions:
201 uri: http://localhost:3000/api/v1/accounts 201 uri: http://localhost:3000/api/v1/accounts
202 response: 202 response:
203 body: 203 body:
204 string: '{"access_token":"fa6GZxjyPYsGuapcEQqdXpY3r9EDnwaAzY4vahT1GNY","token_type":"Bearer","scope":"read 204 string: '{"access_token":"WTJy6jqCcUmPdPRpxGPXGr5tb-u_ZhDZa5BfLrZbR88","token_type":"Bearer","scope":"read
205 write follow push","created_at":1668356996}' 205 write follow push","created_at":1668813030}'
206 headers: 206 headers:
207 Cache-Control: 207 Cache-Control:
208 - no-store 208 - no-store
209 Content-Security-Policy: 209 Content-Security-Policy:
210 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src 210 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
211 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; 211 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
212 style-src ''self'' http://localhost:3000 ''nonce-HeTgpdMKCUkyYQyy5dwEcw==''; 212 style-src ''self'' http://localhost:3000 ''nonce-ZmZ3Nikn0UBUyHH8SPHxmA=='';
213 media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' 213 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
214 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' 214 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
215 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 215 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
@@ -219,7 +219,7 @@ interactions:
219 Content-Type: 219 Content-Type:
220 - application/json; charset=utf-8 220 - application/json; charset=utf-8
221 ETag: 221 ETag:
222 - W/"1ddd115ebd5097ed791b3457e361636a" 222 - W/"f2275c085ebaec598ae00c838b507999"
223 Pragma: 223 Pragma:
224 - no-cache 224 - no-cache
225 Referrer-Policy: 225 Referrer-Policy:
@@ -237,9 +237,69 @@ interactions:
237 X-Permitted-Cross-Domain-Policies: 237 X-Permitted-Cross-Domain-Policies:
238 - none 238 - none
239 X-Request-Id: 239 X-Request-Id:
240 - 1b2b769a-3a32-440b-aeba-b967967f86e6 240 - a2d80241-35a5-48c8-b4c7-1c714869731d
241 X-Runtime: 241 X-Runtime:
242 - '0.088416' 242 - '0.078012'
243 X-XSS-Protection:
244 - 1; mode=block
245 status:
246 code: 200
247 message: OK
248- request:
249 body: null
250 headers:
251 Accept:
252 - '*/*'
253 Accept-Encoding:
254 - gzip, deflate
255 Authorization:
256 - Bearer WTJy6jqCcUmPdPRpxGPXGr5tb-u_ZhDZa5BfLrZbR88
257 Connection:
258 - keep-alive
259 Content-Length:
260 - '0'
261 User-Agent:
262 - mastodonpy
263 method: POST
264 uri: http://localhost:3000/api/v1/emails/confirmations
265 response:
266 body:
267 string: '{}'
268 headers:
269 Cache-Control:
270 - no-store
271 Content-Security-Policy:
272 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
273 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
274 style-src ''self'' http://localhost:3000 ''nonce-7apBIRbCSTiLStbmHNeFgQ=='';
275 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
276 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
277 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
278 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
279 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
280 worker-src ''self'' blob: http://localhost:3000'
281 Content-Type:
282 - application/json; charset=utf-8
283 ETag:
284 - W/"44136fa355b3678a1146ad16f7e8649e"
285 Referrer-Policy:
286 - strict-origin-when-cross-origin
287 Transfer-Encoding:
288 - chunked
289 Vary:
290 - Accept, Origin
291 X-Content-Type-Options:
292 - nosniff
293 X-Download-Options:
294 - noopen
295 X-Frame-Options:
296 - SAMEORIGIN
297 X-Permitted-Cross-Domain-Policies:
298 - none
299 X-Request-Id:
300 - dabc80c7-dd61-4690-97b3-a90194c235e6
301 X-Runtime:
302 - '0.015330'
243 X-XSS-Protection: 303 X-XSS-Protection:
244 - 1; mode=block 304 - 1; mode=block
245 status: 305 status:
diff --git a/tests/test_create_app.py b/tests/test_create_app.py
index 08538ce..8a7ea62 100644
--- a/tests/test_create_app.py
+++ b/tests/test_create_app.py
@@ -66,4 +66,9 @@ def test_app_account_create():
66 ) 66 )
67 test_token = test_app_api.create_account("coolguy" + suffix, "swordfish", "email@localhost" + suffix, agreement=True) 67 test_token = test_app_api.create_account("coolguy" + suffix, "swordfish", "email@localhost" + suffix, agreement=True)
68 assert test_token 68 assert test_token
69 69
70 # We can also test resending (marginally)
71 test_app_api.email_resend_confirmation()
72
73
74
Powered by cgit v1.2.3 (git 2.41.0)