diff options
author | Lorenz Diener <[email protected]> | 2019-10-11 21:51:28 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-10-11 21:51:28 +0200 |
commit | 30eb63261ca5964222f5a2c5f03d6bd537fac987 (patch) | |
tree | 9bc3b796f91c6b3cdabfa1ca386cb2d4b8213469 | |
parent | ec58bd4de87c727d6fd8c71cc8f0d1bb312feae1 (diff) | |
download | mastodon.py-30eb63261ca5964222f5a2c5f03d6bd537fac987.tar.gz |
Implement new notification dismiss behaviour, add test for old behaviour
-rw-r--r-- | mastodon/Mastodon.py | 12 | ||||
-rw-r--r-- | tests/cassettes/test_notifications_dismiss.yaml | 73 | ||||
-rw-r--r-- | tests/test_notifications.py | 8 |
3 files changed, 69 insertions, 24 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index b34e9d4..91f5125 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -1795,15 +1795,19 @@ class Mastodon: | |||
1795 | self.__api_request('POST', '/api/v1/notifications/clear') | 1795 | self.__api_request('POST', '/api/v1/notifications/clear') |
1796 | 1796 | ||
1797 | 1797 | ||
1798 | @api_version("1.3.0", "1.3.0", "1.3.0") | 1798 | @api_version("1.3.0", "2.9.2", "2.9.2") |
1799 | def notifications_dismiss(self, id): | 1799 | def notifications_dismiss(self, id): |
1800 | """ | 1800 | """ |
1801 | Deletes a single notification | 1801 | Deletes a single notification |
1802 | """ | 1802 | """ |
1803 | id = self.__unpack_id(id) | 1803 | id = self.__unpack_id(id) |
1804 | params = self.__generate_params(locals()) | 1804 | |
1805 | self.__api_request('POST', '/api/v1/notifications/dismiss', params) | 1805 | if self.verify_minimum_version("2.9.2"): |
1806 | 1806 | url = '/api/v1/notifications/{0}/dismiss'.format(str(id)) | |
1807 | return self.__api_request('POST', '/api/v1/notifications/dismiss', params) | ||
1808 | else: | ||
1809 | params = self.__generate_params(locals()) | ||
1810 | self.__api_request('POST', '/api/v1/notifications/dismiss', params) | ||
1807 | 1811 | ||
1808 | ### | 1812 | ### |
1809 | # Writing data: Conversations | 1813 | # Writing data: Conversations |
diff --git a/tests/cassettes/test_notifications_dismiss.yaml b/tests/cassettes/test_notifications_dismiss.yaml index 25c31e2..a7af8d2 100644 --- a/tests/cassettes/test_notifications_dismiss.yaml +++ b/tests/cassettes/test_notifications_dismiss.yaml | |||
@@ -12,11 +12,11 @@ interactions: | |||
12 | method: POST | 12 | method: POST |
13 | uri: http://localhost:3000/api/v1/statuses | 13 | uri: http://localhost:3000/api/v1/statuses |
14 | response: | 14 | response: |
15 | body: {string: '{"id":"102317291057725861","created_at":"2019-06-22T21:12:41.706Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost/users/admin/statuses/102317291057725861","url":"http://localhost/@admin/102317291057725861","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"content":"\u003cp\u003e\u003cspan | 15 | body: {string: '{"id":"102945481191655042","created_at":"2019-10-11T19:49:42.450Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost/users/admin/statuses/102945481191655042","url":"http://localhost/@admin/102945481191655042","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"content":"\u003cp\u003e\u003cspan |
16 | class=\"h-card\"\u003e\u003ca href=\"http://localhost/@mastodonpy_test\" class=\"u-url | 16 | class=\"h-card\"\u003e\u003ca href=\"http://localhost/@mastodonpy_test\" class=\"u-url |
17 | mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e | 17 | mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e |
18 | hello!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py test | 18 | hello!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py test |
19 | suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":17,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1234567890123456","username":"mastodonpy_test","url":"http://localhost/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}'} | 19 | suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":20,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1234567890123456","username":"mastodonpy_test","url":"http://localhost/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}'} |
20 | headers: | 20 | headers: |
21 | Cache-Control: ['no-cache, no-store'] | 21 | Cache-Control: ['no-cache, no-store'] |
22 | Content-Type: [application/json; charset=utf-8] | 22 | Content-Type: [application/json; charset=utf-8] |
@@ -27,8 +27,8 @@ interactions: | |||
27 | X-Download-Options: [noopen] | 27 | X-Download-Options: [noopen] |
28 | X-Frame-Options: [SAMEORIGIN] | 28 | X-Frame-Options: [SAMEORIGIN] |
29 | X-Permitted-Cross-Domain-Policies: [none] | 29 | X-Permitted-Cross-Domain-Policies: [none] |
30 | X-Request-Id: [93a5beb9-f93d-4498-a0a6-c08258d72d95] | 30 | X-Request-Id: [116f5b2b-1d95-4382-9c2c-cc392a5f684c] |
31 | X-Runtime: ['0.229491'] | 31 | X-Runtime: ['0.211426'] |
32 | X-XSS-Protection: [1; mode=block] | 32 | X-XSS-Protection: [1; mode=block] |
33 | content-length: ['1488'] | 33 | content-length: ['1488'] |
34 | status: {code: 200, message: OK} | 34 | status: {code: 200, message: OK} |
@@ -43,16 +43,51 @@ interactions: | |||
43 | method: GET | 43 | method: GET |
44 | uri: http://localhost:3000/api/v1/notifications | 44 | uri: http://localhost:3000/api/v1/notifications |
45 | response: | 45 | response: |
46 | body: {string: '[{"id":"112","type":"mention","created_at":"2019-06-22T21:12:41.829Z","account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":17,"emojis":[],"fields":[]},"status":{"id":"102317291057725861","created_at":"2019-06-22T21:12:41.706Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost/users/admin/statuses/102317291057725861","url":"http://localhost/@admin/102317291057725861","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"content":"\u003cp\u003e\u003cspan | 46 | body: {string: '[{"id":"124","type":"mention","created_at":"2019-10-11T19:49:42.579Z","account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":20,"emojis":[],"fields":[]},"status":{"id":"102945481191655042","created_at":"2019-10-11T19:49:42.450Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost/users/admin/statuses/102945481191655042","url":"http://localhost/@admin/102945481191655042","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"content":"\u003cp\u003e\u003cspan |
47 | class=\"h-card\"\u003e\u003ca href=\"http://localhost/@mastodonpy_test\" class=\"u-url | 47 | class=\"h-card\"\u003e\u003ca href=\"http://localhost/@mastodonpy_test\" class=\"u-url |
48 | mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e | 48 | mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e |
49 | hello!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py test | 49 | hello!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py test |
50 | suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":17,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1234567890123456","username":"mastodonpy_test","url":"http://localhost/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}}]'} | 50 | suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":20,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1234567890123456","username":"mastodonpy_test","url":"http://localhost/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"120","type":"poll","created_at":"2019-06-22T21:18:06.944Z","account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":20,"emojis":[],"fields":[]},"status":{"id":"102317292327454763","created_at":"2019-06-22T21:13:01.083Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost/users/admin/statuses/102317292327454763","url":"http://localhost/@admin/102317292327454763","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"content":"\u003cp\u003enice\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
51 | test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":20,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":{"id":"16","expires_at":"2019-06-22T21:18:01.074Z","expired":true,"multiple":false,"votes_count":1,"voted":true,"options":[{"title":"four | ||
52 | twenty","votes_count":0},{"title":"sixty-nine","votes_count":1}],"emojis":[]}}},{"id":"115","type":"mention","created_at":"2019-06-22T21:13:26.829Z","account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":20,"emojis":[],"fields":[]},"status":{"id":"102317294005876209","created_at":"2019-06-22T21:13:26.706Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost/users/admin/statuses/102317294005876209","url":"http://localhost/@admin/102317294005876209","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"content":"\u003cp\u003e\u003cspan | ||
53 | class=\"h-card\"\u003e\u003ca href=\"http://localhost/@mastodonpy_test\" class=\"u-url | ||
54 | mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e | ||
55 | beep beep I\u0026apos;m a jeep\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
56 | test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":20,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1234567890123456","username":"mastodonpy_test","url":"http://localhost/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}}]'} | ||
51 | headers: | 57 | headers: |
52 | Cache-Control: ['no-cache, no-store'] | 58 | Cache-Control: ['no-cache, no-store'] |
53 | Content-Type: [application/json; charset=utf-8] | 59 | Content-Type: [application/json; charset=utf-8] |
54 | Link: ['<http://localhost:3000/api/v1/notifications?max_id=112>; rel="next", | 60 | Link: ['<http://localhost:3000/api/v1/notifications?max_id=115>; rel="next", |
55 | <http://localhost:3000/api/v1/notifications?min_id=112>; rel="prev"'] | 61 | <http://localhost:3000/api/v1/notifications?min_id=124>; rel="prev"'] |
62 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
63 | Transfer-Encoding: [chunked] | ||
64 | Vary: ['Accept-Encoding, Origin'] | ||
65 | X-Content-Type-Options: [nosniff] | ||
66 | X-Download-Options: [noopen] | ||
67 | X-Frame-Options: [SAMEORIGIN] | ||
68 | X-Permitted-Cross-Domain-Policies: [none] | ||
69 | X-Request-Id: [e8ea61bd-7565-4392-9a7a-e6152a5635d1] | ||
70 | X-Runtime: ['0.126201'] | ||
71 | X-XSS-Protection: [1; mode=block] | ||
72 | content-length: ['6180'] | ||
73 | status: {code: 200, message: OK} | ||
74 | - request: | ||
75 | body: null | ||
76 | headers: | ||
77 | Accept: ['*/*'] | ||
78 | Accept-Encoding: ['gzip, deflate'] | ||
79 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
80 | Connection: [keep-alive] | ||
81 | User-Agent: [python-requests/2.18.4] | ||
82 | method: GET | ||
83 | uri: http://localhost:3000/api/v1/instance/ | ||
84 | response: | ||
85 | body: {string: '{"uri":"localhost","title":"Mastodon","description":"","email":"","version":"2.9.1","urls":{"streaming_api":"ws://localhost:4000"},"stats":{"user_count":3,"status_count":21,"domain_count":0},"thumbnail":"http://localhost/packs/media/images/preview-9a17d32fc48369e8ccd910a75260e67d.jpg","languages":["en"],"registrations":true,"contact_account":null}'} | ||
86 | headers: | ||
87 | Cache-Control: ['max-age=300, public'] | ||
88 | Content-Type: [application/json; charset=utf-8] | ||
89 | Date: ['Fri, 11 Oct 2019 19:49:42 GMT'] | ||
90 | ETag: [W/"b6028559f8312dda8add94d97903ca58"] | ||
56 | Referrer-Policy: [strict-origin-when-cross-origin] | 91 | Referrer-Policy: [strict-origin-when-cross-origin] |
57 | Transfer-Encoding: [chunked] | 92 | Transfer-Encoding: [chunked] |
58 | Vary: ['Accept-Encoding, Origin'] | 93 | Vary: ['Accept-Encoding, Origin'] |
@@ -60,13 +95,13 @@ interactions: | |||
60 | X-Download-Options: [noopen] | 95 | X-Download-Options: [noopen] |
61 | X-Frame-Options: [SAMEORIGIN] | 96 | X-Frame-Options: [SAMEORIGIN] |
62 | X-Permitted-Cross-Domain-Policies: [none] | 97 | X-Permitted-Cross-Domain-Policies: [none] |
63 | X-Request-Id: [a381923e-e73f-479f-acea-eae201792ae7] | 98 | X-Request-Id: [866137ef-767a-4738-aaf8-687d0b5f6062] |
64 | X-Runtime: ['0.095464'] | 99 | X-Runtime: ['0.054816'] |
65 | X-XSS-Protection: [1; mode=block] | 100 | X-XSS-Protection: [1; mode=block] |
66 | content-length: ['2089'] | 101 | content-length: ['349'] |
67 | status: {code: 200, message: OK} | 102 | status: {code: 200, message: OK} |
68 | - request: | 103 | - request: |
69 | body: id=112 | 104 | body: id=124 |
70 | headers: | 105 | headers: |
71 | Accept: ['*/*'] | 106 | Accept: ['*/*'] |
72 | Accept-Encoding: ['gzip, deflate'] | 107 | Accept-Encoding: ['gzip, deflate'] |
@@ -89,8 +124,8 @@ interactions: | |||
89 | X-Download-Options: [noopen] | 124 | X-Download-Options: [noopen] |
90 | X-Frame-Options: [SAMEORIGIN] | 125 | X-Frame-Options: [SAMEORIGIN] |
91 | X-Permitted-Cross-Domain-Policies: [none] | 126 | X-Permitted-Cross-Domain-Policies: [none] |
92 | X-Request-Id: [6d7d73d4-f824-4b47-805f-1552bc92f7d8] | 127 | X-Request-Id: [3e179fba-39e7-4e2c-b58e-db7dc3fa2f03] |
93 | X-Runtime: ['0.041361'] | 128 | X-Runtime: ['0.038802'] |
94 | X-XSS-Protection: [1; mode=block] | 129 | X-XSS-Protection: [1; mode=block] |
95 | content-length: ['2'] | 130 | content-length: ['2'] |
96 | status: {code: 200, message: OK} | 131 | status: {code: 200, message: OK} |
@@ -104,10 +139,10 @@ interactions: | |||
104 | Content-Length: ['0'] | 139 | Content-Length: ['0'] |
105 | User-Agent: [python-requests/2.18.4] | 140 | User-Agent: [python-requests/2.18.4] |
106 | method: DELETE | 141 | method: DELETE |
107 | uri: http://localhost:3000/api/v1/statuses/102317291057725861 | 142 | uri: http://localhost:3000/api/v1/statuses/102945481191655042 |
108 | response: | 143 | response: |
109 | body: {string: '{"id":"102317291057725861","created_at":"2019-06-22T21:12:41.706Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost/users/admin/statuses/102317291057725861","url":"http://localhost/@admin/102317291057725861","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"text":"@mastodonpy_test | 144 | body: {string: '{"id":"102945481191655042","created_at":"2019-10-11T19:49:42.450Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost/users/admin/statuses/102945481191655042","url":"http://localhost/@admin/102945481191655042","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"text":"@mastodonpy_test |
110 | hello!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":17,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1234567890123456","username":"mastodonpy_test","url":"http://localhost/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}'} | 145 | hello!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T12:42:50.096Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@admin","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":2,"following_count":1,"statuses_count":20,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1234567890123456","username":"mastodonpy_test","url":"http://localhost/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}'} |
111 | headers: | 146 | headers: |
112 | Cache-Control: ['no-cache, no-store'] | 147 | Cache-Control: ['no-cache, no-store'] |
113 | Content-Type: [application/json; charset=utf-8] | 148 | Content-Type: [application/json; charset=utf-8] |
@@ -118,8 +153,8 @@ interactions: | |||
118 | X-Download-Options: [noopen] | 153 | X-Download-Options: [noopen] |
119 | X-Frame-Options: [SAMEORIGIN] | 154 | X-Frame-Options: [SAMEORIGIN] |
120 | X-Permitted-Cross-Domain-Policies: [none] | 155 | X-Permitted-Cross-Domain-Policies: [none] |
121 | X-Request-Id: [d8419c44-3f0a-4c22-b486-fe69128ad00a] | 156 | X-Request-Id: [881b7e0e-4ee4-485c-9b01-746d55c0d4f7] |
122 | X-Runtime: ['0.137253'] | 157 | X-Runtime: ['0.070719'] |
123 | X-XSS-Protection: [1; mode=block] | 158 | X-XSS-Protection: [1; mode=block] |
124 | content-length: ['1281'] | 159 | content-length: ['1281'] |
125 | status: {code: 200, message: OK} | 160 | status: {code: 200, message: OK} |
diff --git a/tests/test_notifications.py b/tests/test_notifications.py index 87c898a..3032519 100644 --- a/tests/test_notifications.py +++ b/tests/test_notifications.py | |||
@@ -1,4 +1,5 @@ | |||
1 | import pytest | 1 | import pytest |
2 | import vcr | ||
2 | 3 | ||
3 | @pytest.fixture() | 4 | @pytest.fixture() |
4 | def mention(api2): | 5 | def mention(api2): |
@@ -14,7 +15,12 @@ def test_notifications(api, mention): | |||
14 | @pytest.mark.vcr() | 15 | @pytest.mark.vcr() |
15 | def test_notifications_dismiss(api, mention): | 16 | def test_notifications_dismiss(api, mention): |
16 | notifications = api.notifications() | 17 | notifications = api.notifications() |
17 | api.notifications_dismiss(notifications[0]) | 18 | api.notifications_dismiss(notifications[0]) # TODO possibly verify that this returns a notif dict |
19 | |||
20 | def test_notifications_dismiss_pre_2_9_2(api, mention): | ||
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() | ||
23 | api.notifications_dismiss(notifications[0]) | ||
18 | 24 | ||
19 | @pytest.mark.vcr() | 25 | @pytest.mark.vcr() |
20 | def test_notifications_clear(api): | 26 | def test_notifications_clear(api): |