diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml | 136 | ||||
-rw-r--r-- | tests/test_notifications.py | 12 |
2 files changed, 116 insertions, 32 deletions
diff --git a/tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml b/tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml index 0a5cf03..466ee25 100644 --- a/tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml +++ b/tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml | |||
@@ -1,5 +1,45 @@ | |||
1 | interactions: | 1 | interactions: |
2 | - request: | 2 | - request: |
3 | body: status=%40mastodonpy_test+hello%21 | ||
4 | headers: | ||
5 | Accept: ['*/*'] | ||
6 | Accept-Encoding: ['gzip, deflate'] | ||
7 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2] | ||
8 | Connection: [keep-alive] | ||
9 | Content-Length: ['34'] | ||
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/statuses | ||
14 | response: | ||
15 | body: | ||
16 | string: !!binary | | ||
17 | H4sIAFTpoF0AA5RU246bMBD9ldTPTTDktiBV2h/o2z61qdDEOODW2BY22UbR/nvHYBKSoKz6hOfM | ||
18 | nBmP5wxnIgqSkZgm6Wq9Sel2u07jOE1T8pWwhoPjRQ4OIxIap/OYzuP4LaHZaplRulhtVz8wTqi8 | ||
19 | 4Uaecqdzn021Ut6iwJhulRt5LVdWOHHkJDuAtBwRo4XkTe74X18P8x6FFXshhTuhbdq9FAxRCaps | ||
20 | oUQi4QrtthF4rJwzWRRJzUBW2rqotbyxERS1UJF14NC20WSbbSOnErz23EmKb0xwm3ddkYx6ZC91 | ||
21 | OUYOcNR4N8cnweLSd88sR0jdjv1GKDUymVaO+2xk11K6ZKb78N6wBtSMSbD2245UcwZNsSPjAJhV | ||
22 | DT9450O7NVinC60MToxbtyOXRO0cn2hWY1Wh1ZDv9VqxB+75nTu6+gMAN9bVPau4lPpLwENXZHie | ||
23 | QTZg8OEZ+IuQ7EwU1F4H30PphTnNfO2ZbfGJkfzO99afOvYH0lkYxTnI3o8fhRLydBMnXZgbmYWw | ||
24 | RsIpD1Feg5r9Gc1kr911Pg9LQzfzJHmLk2yVZGu6oOnGL43S/l5TQxw1/1Sa/qJHcNBMhfQeG+lG | ||
25 | lEKBjGphrVDlwqjyQsz9YuBS/T+/4lDwycK95xPik8Kf8A8aVfKOAcNSJQOGMQMW498krPwlDJeP | ||
26 | 1/q3sCT7+Qs5gsuiO6Msal4IwIk5YJWXeYgJivfWoJdkif+C7UtK+9OtfO424Mn8HiOD5O4dH3gN | ||
27 | B2W40LgBv9vDVhh8gKDxfwAAAP//AwBP4Bk20AUAAA== | ||
28 | headers: | ||
29 | Cache-Control: ['no-cache, no-store'] | ||
30 | Content-Encoding: [gzip] | ||
31 | Content-Type: [application/json; charset=utf-8] | ||
32 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
33 | Vary: ['Accept-Encoding, Origin'] | ||
34 | X-Content-Type-Options: [nosniff] | ||
35 | X-Download-Options: [noopen] | ||
36 | X-Frame-Options: [SAMEORIGIN] | ||
37 | X-Permitted-Cross-Domain-Policies: [none] | ||
38 | X-Request-Id: [c8f1a689-c9e4-484c-ac27-2e56b52323ce] | ||
39 | X-Runtime: ['0.316550'] | ||
40 | X-XSS-Protection: [1; mode=block] | ||
41 | status: {code: 200, message: OK} | ||
42 | - request: | ||
3 | body: null | 43 | body: null |
4 | headers: | 44 | headers: |
5 | Accept: ['*/*'] | 45 | Accept: ['*/*'] |
@@ -12,37 +52,37 @@ interactions: | |||
12 | response: | 52 | response: |
13 | body: | 53 | body: |
14 | string: !!binary | | 54 | string: !!binary | |
15 | H4sIACbooF0AA+xZS4/iOBD+K9mcgTjOi2Q10lz3sLc57fQImcSAZxzbih260Yr/vuU8SHhMQ49G | 55 | H4sIAFTpoF0AA+x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X0aDcNL9kNnpgZqr6 |
29 | bOGGKT4Ukr0c5Zzfjk/aUg00wDBjzSAkdeWYZ3Dg4F6YI9uDez3NXsxhLpigl2r+8czT46h1+9Fj | 69 | lC3C8FL0hWSvBjmHm/FZW5U9DTDcWDMISV055hEcOLhX5sj24E5P8ydzmEsu2bUaPl54ehy0bhze |
30 | L/zj0orjxRKnU/eecvBt3TtEKFomMUbpIxBL0Mf7Y+Dazce695nJO+jeH/+Ff02paj/+shIcEyX1 | 70 | 98I/LK0kWixJMnXvKQdf170DhMJlHBE0/sfAFcRiFL3P7n3h5n3d+8LkDXTv9//Cv2asbD4+WwmJ |
31 | n6VDnO8gnJjJVBXfITP5OK/+3/4DAAD//wMAcL5C61ogAAA= | 71 | aKn0P4VDnZ8gnJjJVBXfIDN5P6/+P/4DAAD//wMArULE9VogAAA= |
32 | headers: | 72 | headers: |
33 | Cache-Control: ['no-cache, no-store'] | 73 | Cache-Control: ['no-cache, no-store'] |
34 | Content-Encoding: [gzip] | 74 | Content-Encoding: [gzip] |
35 | Content-Type: [application/json; charset=utf-8] | 75 | Content-Type: [application/json; charset=utf-8] |
36 | Link: ['<http://localhost:3000/api/v1/notifications?max_id=115>; rel="next", | 76 | Link: ['<http://localhost:3000/api/v1/notifications?max_id=115>; rel="next", |
37 | <http://localhost:3000/api/v1/notifications?min_id=132>; rel="prev"'] | 77 | <http://localhost:3000/api/v1/notifications?min_id=134>; rel="prev"'] |
38 | Referrer-Policy: [strict-origin-when-cross-origin] | 78 | Referrer-Policy: [strict-origin-when-cross-origin] |
39 | Vary: ['Accept-Encoding, Origin'] | 79 | Vary: ['Accept-Encoding, Origin'] |
40 | X-Content-Type-Options: [nosniff] | 80 | X-Content-Type-Options: [nosniff] |
41 | X-Download-Options: [noopen] | 81 | X-Download-Options: [noopen] |
42 | X-Frame-Options: [SAMEORIGIN] | 82 | X-Frame-Options: [SAMEORIGIN] |
43 | X-Permitted-Cross-Domain-Policies: [none] | 83 | X-Permitted-Cross-Domain-Policies: [none] |
44 | X-Request-Id: [c803dcde-b4b2-4c79-ad89-8bfd07ec57ae] | 84 | X-Request-Id: [7332ffde-9101-4a43-82b4-a4f0ecbce551] |
45 | X-Runtime: ['0.150857'] | 85 | X-Runtime: ['0.131203'] |
46 | X-XSS-Protection: [1; mode=block] | 86 | X-XSS-Protection: [1; mode=block] |
47 | status: {code: 200, message: OK} | 87 | status: {code: 200, message: OK} |
48 | - request: | 88 | - request: |
@@ -58,7 +98,7 @@ interactions: | |||
58 | response: | 98 | response: |
59 | body: | 99 | body: |
60 | string: !!binary | | 100 | string: !!binary | |
61 | H4sIACbooF0AA0yQXU7EMAyE7+Ln0vRnabe5AydAqDKJaQNpEiXO7sNq705KWcSb/WlGM/YNcjQg | 101 | H4sIAFTpoF0AA0yQXU7EMAyE7+Ln0vRnabe5AydAqDKJaQNpEiXO7sNq705KWcSb/WlGM/YNcjQg |
62 | wXqFdvWJoQI2bKmwF0zstXcFaUoqmsCmbBIKoA2NPcYLxXTwrp7qtpAcbQJ5g8SRcDNumTHsIdck | 102 | wXqFdvWJoQI2bKmwF0zstXcFaUoqmsCmbBIKoA2NPcYLxXTwrp7qtpAcbQJ5g8SRcDNumTHsIdck |
63 | hfhLkqemaeBeFRnyjz4nirPy2THI/uA5PUDXlhq+xLoHaYqX17y9u6PLyhz+B4iA6iuJjbRBYTZc | 103 | hfhLkqemaeBeFRnyjz4nirPy2THI/uA5PUDXlhq+xLoHaYqX17y9u6PLyhz+B4iA6iuJjbRBYTZc |
64 | KIkQ6WLo+jRhO+q++1Cncz9MdFZKT22D43M3NDSMuv4MS7nEolvybgT5CuTgrYJIiymH4f6Lgjlm | 104 | KIkQ6WLo+jRhO+q++1Cncz9MdFZKT22D43M3NDSMuv4MS7nEolvybgT5CuTgrYJIiymH4f6Lgjlm |
@@ -67,20 +107,20 @@ interactions: | |||
67 | Cache-Control: ['max-age=300, public'] | 107 | Cache-Control: ['max-age=300, public'] |
68 | Content-Encoding: [gzip] | 108 | Content-Encoding: [gzip] |
69 | Content-Type: [application/json; charset=utf-8] | 109 | Content-Type: [application/json; charset=utf-8] |
70 | Date: ['Fri, 11 Oct 2019 20:37:58 GMT'] | 110 | Date: ['Fri, 11 Oct 2019 20:43:00 GMT'] |
71 | ETag: [W/"ad87f54668db431e5bc3f918c2e6980a"] | 111 | ETag: [W/"ad29a128469658ac7b93b5ec01dbc18f"] |
72 | Referrer-Policy: [strict-origin-when-cross-origin] | 112 | Referrer-Policy: [strict-origin-when-cross-origin] |
73 | Vary: ['Accept-Encoding, Origin'] | 113 | Vary: ['Accept-Encoding, Origin'] |
74 | X-Content-Type-Options: [nosniff] | 114 | X-Content-Type-Options: [nosniff] |
75 | X-Download-Options: [noopen] | 115 | X-Download-Options: [noopen] |
76 | X-Frame-Options: [SAMEORIGIN] | 116 | X-Frame-Options: [SAMEORIGIN] |
77 | X-Permitted-Cross-Domain-Policies: [none] | 117 | X-Permitted-Cross-Domain-Policies: [none] |
78 | X-Request-Id: [c6e9a6fe-e6c0-4fb4-be3f-c946b3c7ab32] | 118 | X-Request-Id: [59964f41-6806-4a96-9a09-5ba735eecb3f] |
79 | X-Runtime: ['0.028744'] | 119 | X-Runtime: ['0.030156'] |
80 | X-XSS-Protection: [1; mode=block] | 120 | X-XSS-Protection: [1; mode=block] |
81 | status: {code: 200, message: OK} | 121 | status: {code: 200, message: OK} |
82 | - request: | 122 | - request: |
83 | body: id=132 | 123 | body: id=134 |
84 | headers: | 124 | headers: |
85 | Accept: ['*/*'] | 125 | Accept: ['*/*'] |
86 | Accept-Encoding: ['gzip, deflate'] | 126 | Accept-Encoding: ['gzip, deflate'] |
@@ -94,7 +134,45 @@ interactions: | |||
94 | response: | 134 | response: |
95 | body: | 135 | body: |
96 | string: !!binary | | 136 | string: !!binary | |
97 | H4sIACbooF0AA6quBQAAAP//AwBDv6ajAgAAAA== | 137 | H4sIAFTpoF0AA6quBQAAAP//AwBDv6ajAgAAAA== |
138 | headers: | ||
139 | Cache-Control: ['no-cache, no-store'] | ||
140 | Content-Encoding: [gzip] | ||
141 | Content-Type: [application/json; charset=utf-8] | ||
142 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
143 | Vary: ['Accept-Encoding, Origin'] | ||
144 | X-Content-Type-Options: [nosniff] | ||
145 | X-Download-Options: [noopen] | ||
146 | X-Frame-Options: [SAMEORIGIN] | ||
147 | X-Permitted-Cross-Domain-Policies: [none] | ||
148 | X-Request-Id: [9093e35a-5e86-4974-b423-90e9268c082c] | ||
149 | X-Runtime: ['0.026793'] | ||
150 | X-XSS-Protection: [1; mode=block] | ||
151 | status: {code: 200, message: OK} | ||
152 | - request: | ||
153 | body: null | ||
154 | headers: | ||
155 | Accept: ['*/*'] | ||
156 | Accept-Encoding: ['gzip, deflate'] | ||
157 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2] | ||
158 | Connection: [keep-alive] | ||
159 | Content-Length: ['0'] | ||
160 | User-Agent: [python-requests/2.18.4] | ||
161 | method: DELETE | ||
162 | uri: http://localhost:3000/api/v1/statuses/102945690775911999 | ||
163 | response: | ||
164 | body: | ||
165 | string: !!binary | | ||
166 | H4sIAFXpoF0AA5RU23KbMBD9lVTPtRH4FnjKD/QtT70MsxYybCskDRJOPZ78e1cgPCRh4ukTezln | ||
167 | tbs64sqwYgVLeZZvd/ucHw67PE3zPGdfmegkeFmV4AmR8TRfpXyVps8ZL7abgvP19rD9TjjUZSet | ||
168 | upTelKGa7pV6GwUhTK/9LOukdujxLFlxAuUkRaxBJbvSy7/hPKp7RodHVOgv5Nv+qFBQVIGue6iJ | ||
169 | yKQmv++QzMZ7WySJMgJUY5xPeic7l0DVok6cB0++SxbH7Du1VOBp5C5SwmAoXTlMxQoeIkdl6nnk | ||
170 | BGdDvXm5GKxuc4/MehZp+3neotYzN67nqQXnTWW0pQVL5x8aqZT5wqZ6057BUqcCPBrNiivT0IbF | ||
171 | fYvktb08DGzXU09EfpFHF6yB/Up0EXu/Rp2EfdFmY51hRWyA+ZlbobMKLmVEhUsz4s9siKPxN/uj | ||
172 | yvh+lWXPaVZss2LH1zzfB5VpE/piP3vON8IOHzk6SfTu3WVo9AweuiXImHGJ6bBGDSpp0TnU9drq | ||
173 | +kYsg5JIhf/PbyRUcvHgMXOH+MnBd/gnQ7p4IcCkwmyKEWaKpfT84hu5wUitsjW/0bHixy/ioFTV | ||
174 | YJMsWlkh0I15EE0rtY+YYJLQgjfpJdvQ4zk85ny03srnnYY/ub+PyCi594lXasNDHRuaDyCgu/19 | ||
175 | LC0gavwfAAAA//8DAPavAQgBBQAA | ||
98 | headers: | 176 | headers: |
99 | Cache-Control: ['no-cache, no-store'] | 177 | Cache-Control: ['no-cache, no-store'] |
100 | Content-Encoding: [gzip] | 178 | Content-Encoding: [gzip] |
@@ -105,8 +183,8 @@ interactions: | |||
105 | X-Download-Options: [noopen] | 183 | X-Download-Options: [noopen] |
106 | X-Frame-Options: [SAMEORIGIN] | 184 | X-Frame-Options: [SAMEORIGIN] |
107 | X-Permitted-Cross-Domain-Policies: [none] | 185 | X-Permitted-Cross-Domain-Policies: [none] |
108 | X-Request-Id: [4a767314-d1c1-4872-a9e1-fc3186b4b2a1] | 186 | X-Request-Id: [09583968-dd77-4f00-9afe-4803a55d4157] |
109 | X-Runtime: ['0.031584'] | 187 | X-Runtime: ['0.083699'] |
110 | X-XSS-Protection: [1; mode=block] | 188 | X-XSS-Protection: [1; mode=block] |
111 | status: {code: 200, message: OK} | 189 | status: {code: 200, message: OK} |
112 | version: 1 | 190 | version: 1 |
diff --git a/tests/test_notifications.py b/tests/test_notifications.py index 3032519..ab9ac31 100644 --- a/tests/test_notifications.py +++ b/tests/test_notifications.py | |||
@@ -17,10 +17,16 @@ def test_notifications_dismiss(api, mention): | |||
17 | notifications = api.notifications() | 17 | notifications = api.notifications() |
18 | api.notifications_dismiss(notifications[0]) # TODO possibly verify that this returns a notif dict | 18 | api.notifications_dismiss(notifications[0]) # TODO possibly verify that this returns a notif dict |
19 | 19 | ||
20 | def test_notifications_dismiss_pre_2_9_2(api, mention): | 20 | def test_notifications_dismiss_pre_2_9_2(api, api2): |
21 | with vcr.use_cassette('test_notifications_dismiss.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'): | 21 | with vcr.use_cassette('test_notifications_dismiss.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'): |
22 | notifications = api.notifications() | 22 | status = None |
23 | api.notifications_dismiss(notifications[0]) | 23 | try: |
24 | status = api2.status_post('@mastodonpy_test hello!') | ||
25 | notifications = api.notifications() | ||
26 | api.notifications_dismiss(notifications[0]) | ||
27 | finally: | ||
28 | if not status is None: | ||
29 | api2.status_delete(status) | ||
24 | 30 | ||
25 | @pytest.mark.vcr() | 31 | @pytest.mark.vcr() |
26 | def test_notifications_clear(api): | 32 | def test_notifications_clear(api): |