aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-04-28 13:58:18 +0200
committerLorenz Diener <[email protected]>2019-04-28 13:58:18 +0200
commitac7196c443db8453ccb6c3c2407c9e844ea4cbae (patch)
treea8e3b7f1f3e8c42ebbca7b4d2362e0e53b5d7670
parent06df1c281eb0825ec9f646960f4d9426eba7e081 (diff)
downloadmastodon.py-ac7196c443db8453ccb6c3c2407c9e844ea4cbae.tar.gz
Add conversation read marking + tests/docs
-rw-r--r--docs/index.rst16
-rw-r--r--mastodon/Mastodon.py15
-rw-r--r--tests/cassettes/test_conversations.yaml131
-rw-r--r--tests/test_timeline.py6
4 files changed, 142 insertions, 26 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 9bbd6f7..48fb0c1 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -3,7 +3,7 @@ Mastodon.py
3.. py:module:: mastodon 3.. py:module:: mastodon
4.. py:class: Mastodon 4.. py:class: Mastodon
5 5
6Register your app! This only needs to be done once. Uncomment the code and substitute in your information. 6Register your app! This only needs to be done once. Uncomment the code and substitute in your information:
7 7
8.. code-block:: python 8.. code-block:: python
9 9
@@ -17,7 +17,7 @@ Register your app! This only needs to be done once. Uncomment the code and subst
17 ) 17 )
18 ''' 18 '''
19 19
20Then login. This can be done every time, or use persisted. 20Then login. This can be done every time, or you can use the persisted information:
21 21
22.. code-block:: python 22.. code-block:: python
23 23
@@ -33,7 +33,7 @@ Then login. This can be done every time, or use persisted.
33 to_file = 'pytooter_usercred.secret' 33 to_file = 'pytooter_usercred.secret'
34 ) 34 )
35 35
36To post, create an actual API instance. 36To post, create an actual API instance:
37 37
38.. code-block:: python 38.. code-block:: python
39 39
@@ -790,7 +790,7 @@ These functions allow you to view information about lists.
790Reading data: Follows 790Reading data: Follows
791--------------------- 791---------------------
792 792
793.. automethod:: Mastodon.follows 793.. automethod:: Mastodon.followshttps://docs.joinmastodon.org/api/rest
794 794
795Reading data: Favourites 795Reading data: Favourites
796------------------------ 796------------------------
@@ -868,6 +868,12 @@ These functions allow you to clear all or some notifications.
868.. automethod:: Mastodon.notifications_clear 868.. automethod:: Mastodon.notifications_clear
869.. automethod:: Mastodon.notifications_dismiss 869.. automethod:: Mastodon.notifications_dismiss
870 870
871Writing data: Conversations
872---------------------------
873This function allows you to mark conversations read.
874
875.. automethod:: Mastodon.conversations_read
876
871Writing data: Accounts 877Writing data: Accounts
872---------------------- 878----------------------
873These functions allow you to interact with other accounts: To (un)follow and 879These functions allow you to interact with other accounts: To (un)follow and
@@ -1023,4 +1029,4 @@ about who helped with which particular feature or fix in the changelog.
1023 1029
1024.. _Mastodon: https://github.com/tootsuite/mastodon 1030.. _Mastodon: https://github.com/tootsuite/mastodon
1025.. _Mastodon flagship instance: http://mastodon.social/ 1031.. _Mastodon flagship instance: http://mastodon.social/
1026.. _Mastodon api docs: https://github.com/tootsuite/documentation/ 1032.. _Official Mastodon api docs: https://docs.joinmastodon.org/api/rest
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 6897bc6..f5bf4ac 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1495,6 +1495,21 @@ class Mastodon:
1495 params = self.__generate_params(locals()) 1495 params = self.__generate_params(locals())
1496 self.__api_request('POST', '/api/v1/notifications/dismiss', params) 1496 self.__api_request('POST', '/api/v1/notifications/dismiss', params)
1497 1497
1498
1499 ###
1500 # Writing data: Conversations
1501 ###
1502 def conversations_read(self, id):
1503 """
1504 Marks a single conversation as read.
1505
1506 WARNING: This method is currently not documented in the official API and
1507 might therefore be unstable.
1508 """
1509 id = self.__unpack_id(id)
1510 url = '/api/v1/conversations/{0}/read'.format(str(id))
1511 return self.__api_request('POST', url)
1512
1498 ### 1513 ###
1499 # Writing data: Accounts 1514 # Writing data: Accounts
1500 ### 1515 ###
diff --git a/tests/cassettes/test_conversations.yaml b/tests/cassettes/test_conversations.yaml
index f4f0b15..105eb98 100644
--- a/tests/cassettes/test_conversations.yaml
+++ b/tests/cassettes/test_conversations.yaml
@@ -14,7 +14,7 @@ interactions:
14 headers: 14 headers:
15 Cache-Control: ['max-age=0, private, must-revalidate'] 15 Cache-Control: ['max-age=0, private, must-revalidate']
16 Content-Type: [application/json; charset=utf-8] 16 Content-Type: [application/json; charset=utf-8]
17 ETag: [W/"22befe12cde5f76de801140c68ff24d7"] 17 ETag: [W/"589b7fc34678284181e4970961b98b8f"]
18 Referrer-Policy: [strict-origin-when-cross-origin] 18 Referrer-Policy: [strict-origin-when-cross-origin]
19 Transfer-Encoding: [chunked] 19 Transfer-Encoding: [chunked]
20 Vary: ['Accept-Encoding, Origin'] 20 Vary: ['Accept-Encoding, Origin']
@@ -22,8 +22,8 @@ interactions:
22 X-Download-Options: [noopen] 22 X-Download-Options: [noopen]
23 X-Frame-Options: [SAMEORIGIN] 23 X-Frame-Options: [SAMEORIGIN]
24 X-Permitted-Cross-Domain-Policies: [none] 24 X-Permitted-Cross-Domain-Policies: [none]
25 X-Request-Id: [f61f2b83-2a73-4874-a883-70240d83b453] 25 X-Request-Id: [9f267b49-db2e-43ae-821d-f8e06bd6ef6e]
26 X-Runtime: ['0.021142'] 26 X-Runtime: ['0.021003']
27 X-XSS-Protection: [1; mode=block] 27 X-XSS-Protection: [1; mode=block]
28 content-length: ['653'] 28 content-length: ['653']
29 status: {code: 200, message: OK} 29 status: {code: 200, message: OK}
@@ -40,15 +40,15 @@ interactions:
40 method: POST 40 method: POST
41 uri: http://localhost:3000/api/v1/statuses 41 uri: http://localhost:3000/api/v1/statuses
42 response: 42 response:
43 body: {string: '{"id":"102003581864478788","created_at":"2019-04-28T11:32:19.297Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003581864478788","content":"\u003cp\u003e\u003cspan 43 body: {string: '{"id":"102003683512723982","created_at":"2019-04-28T11:58:10.333Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003683512723982","content":"\u003cp\u003e\u003cspan
44 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url 44 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
45 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e 45 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
46 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003581864478788","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py 46 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003683512723982","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
47 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}'} 47 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}'}
48 headers: 48 headers:
49 Cache-Control: ['max-age=0, private, must-revalidate'] 49 Cache-Control: ['max-age=0, private, must-revalidate']
50 Content-Type: [application/json; charset=utf-8] 50 Content-Type: [application/json; charset=utf-8]
51 ETag: [W/"dc7ff9b9023358ffdcb2a1507e9e77e6"] 51 ETag: [W/"2664c447c45638697eacdaa9cb643dae"]
52 Referrer-Policy: [strict-origin-when-cross-origin] 52 Referrer-Policy: [strict-origin-when-cross-origin]
53 Transfer-Encoding: [chunked] 53 Transfer-Encoding: [chunked]
54 Vary: ['Accept-Encoding, Origin'] 54 Vary: ['Accept-Encoding, Origin']
@@ -56,8 +56,8 @@ interactions:
56 X-Download-Options: [noopen] 56 X-Download-Options: [noopen]
57 X-Frame-Options: [SAMEORIGIN] 57 X-Frame-Options: [SAMEORIGIN]
58 X-Permitted-Cross-Domain-Policies: [none] 58 X-Permitted-Cross-Domain-Policies: [none]
59 X-Request-Id: [de40a9dc-97f0-4805-a24a-8378f8f37de9] 59 X-Request-Id: [22e1eea7-613e-4a9f-8785-4cca0660a929]
60 X-Runtime: ['0.160974'] 60 X-Runtime: ['0.167697']
61 X-XSS-Protection: [1; mode=block] 61 X-XSS-Protection: [1; mode=block]
62 content-length: ['1475'] 62 content-length: ['1475']
63 status: {code: 200, message: OK} 63 status: {code: 200, message: OK}
@@ -72,11 +72,102 @@ interactions:
72 method: GET 72 method: GET
73 uri: http://localhost:3000/api/v1/conversations/ 73 uri: http://localhost:3000/api/v1/conversations/
74 response: 74 response:
75 body: {string: '[{"id":"24","unread":true,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003581864478788","created_at":"2019-04-28T11:32:19.297Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003581864478788","content":"\u003cp\u003e\u003cspan 75 body: {string: '[{"id":"30","unread":true,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003683512723982","created_at":"2019-04-28T11:58:10.333Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003683512723982","content":"\u003cp\u003e\u003cspan
76 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url 76 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
77 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e 77 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
78 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003581864478788","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py 78 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003683512723982","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
79 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"22","unread":true,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003580476156514","created_at":"2019-04-28T11:31:58.113Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003580476156514","content":"\u003cp\u003e\u003cspan 79 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"26","unread":true,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003680467810506","created_at":"2019-04-28T11:57:23.865Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003680467810506","content":"\u003cp\u003e\u003cspan
80 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
81 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
82 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003680467810506","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
83 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"22","unread":false,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003580476156514","created_at":"2019-04-28T11:31:58.113Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003580476156514","content":"\u003cp\u003e\u003cspan
84 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
85 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
86 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003580476156514","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
87 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"18","unread":true,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003573042670077","created_at":"2019-04-28T11:30:04.687Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003573042670077","content":"\u003cp\u003e\u003cspan
88 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
89 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
90 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003573042670077","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
91 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"14","unread":false,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003565381731428","created_at":"2019-04-28T11:28:07.791Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003565381731428","content":"\u003cp\u003e\u003cspan
92 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
93 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
94 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003565381731428","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
95 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"4","unread":false,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003533707396851","created_at":"2019-04-28T11:20:04.478Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003533707396851","content":"\u003cp\u003e\u003cspan
96 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
97 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
98 test\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003533707396851","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
99 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}}]'}
100 headers:
101 Cache-Control: ['max-age=0, private, must-revalidate']
102 Content-Type: [application/json; charset=utf-8]
103 ETag: [W/"08eb290a1d5b5c9c9f0b6198cb1eba3b"]
104 Link: ['<http://localhost:3000/api/v1/conversations?min_id=102003683512723982>;
105 rel="prev"']
106 Referrer-Policy: [strict-origin-when-cross-origin]
107 Transfer-Encoding: [chunked]
108 Vary: ['Accept-Encoding, Origin']
109 X-Content-Type-Options: [nosniff]
110 X-Download-Options: [noopen]
111 X-Frame-Options: [SAMEORIGIN]
112 X-Permitted-Cross-Domain-Policies: [none]
113 X-Request-Id: [bdcc2508-446e-4366-8c19-f24ba8e165cf]
114 X-Runtime: ['0.184464']
115 X-XSS-Protection: [1; mode=block]
116 content-length: ['12579']
117 status: {code: 200, message: OK}
118- request:
119 body: null
120 headers:
121 Accept: ['*/*']
122 Accept-Encoding: ['gzip, deflate']
123 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2]
124 Connection: [keep-alive]
125 Content-Length: ['0']
126 User-Agent: [python-requests/2.18.4]
127 method: POST
128 uri: http://localhost:3000/api/v1/conversations/30/read
129 response:
130 body: {string: '{"id":"30","unread":false,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003683512723982","created_at":"2019-04-28T11:58:10.333Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003683512723982","content":"\u003cp\u003e\u003cspan
131 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
132 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
133 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003683512723982","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
134 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}}'}
135 headers:
136 Cache-Control: ['max-age=0, private, must-revalidate']
137 Content-Type: [application/json; charset=utf-8]
138 ETag: [W/"13f3289f4d462887396bc58d863578c2"]
139 Referrer-Policy: [strict-origin-when-cross-origin]
140 Transfer-Encoding: [chunked]
141 Vary: ['Accept-Encoding, Origin']
142 X-Content-Type-Options: [nosniff]
143 X-Download-Options: [noopen]
144 X-Frame-Options: [SAMEORIGIN]
145 X-Permitted-Cross-Domain-Policies: [none]
146 X-Request-Id: [60024dfb-b47d-44cd-bf4d-b8ecd77b7848]
147 X-Runtime: ['0.055070']
148 X-XSS-Protection: [1; mode=block]
149 content-length: ['2097']
150 status: {code: 200, message: OK}
151- request:
152 body: null
153 headers:
154 Accept: ['*/*']
155 Accept-Encoding: ['gzip, deflate']
156 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2]
157 Connection: [keep-alive]
158 User-Agent: [python-requests/2.18.4]
159 method: GET
160 uri: http://localhost:3000/api/v1/conversations/
161 response:
162 body: {string: '[{"id":"30","unread":false,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003683512723982","created_at":"2019-04-28T11:58:10.333Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003683512723982","content":"\u003cp\u003e\u003cspan
163 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
164 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
165 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003683512723982","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
166 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"26","unread":true,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003680467810506","created_at":"2019-04-28T11:57:23.865Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003680467810506","content":"\u003cp\u003e\u003cspan
167 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
168 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
169 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003680467810506","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
170 test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"1","username":"admin","url":"http://localhost/@admin","acct":"admin"}],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"22","unread":false,"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","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":0,"following_count":0,"statuses_count":4,"emojis":[],"fields":[]}],"last_status":{"id":"102003580476156514","created_at":"2019-04-28T11:31:58.113Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102003580476156514","content":"\u003cp\u003e\u003cspan
80 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url 171 class=\"h-card\"\u003e\u003ca href=\"http://localhost/@admin\" class=\"u-url
81 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e 172 mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
82 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003580476156514","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py 173 ilu bby ;3\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102003580476156514","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
@@ -96,8 +187,8 @@ interactions:
96 headers: 187 headers:
97 Cache-Control: ['max-age=0, private, must-revalidate'] 188 Cache-Control: ['max-age=0, private, must-revalidate']
98 Content-Type: [application/json; charset=utf-8] 189 Content-Type: [application/json; charset=utf-8]
99 ETag: [W/"79b5a64acc37c8440422aa5612672686"] 190 ETag: [W/"72bd0df2c4806b9f75ad414206794e61"]
100 Link: ['<http://localhost:3000/api/v1/conversations?min_id=102003581864478788>; 191 Link: ['<http://localhost:3000/api/v1/conversations?min_id=102003683512723982>;
101 rel="prev"'] 192 rel="prev"']
102 Referrer-Policy: [strict-origin-when-cross-origin] 193 Referrer-Policy: [strict-origin-when-cross-origin]
103 Transfer-Encoding: [chunked] 194 Transfer-Encoding: [chunked]
@@ -106,10 +197,10 @@ interactions:
106 X-Download-Options: [noopen] 197 X-Download-Options: [noopen]
107 X-Frame-Options: [SAMEORIGIN] 198 X-Frame-Options: [SAMEORIGIN]
108 X-Permitted-Cross-Domain-Policies: [none] 199 X-Permitted-Cross-Domain-Policies: [none]
109 X-Request-Id: [b9d855cb-8dcd-4498-ae9c-57a9891c1d19] 200 X-Request-Id: [f8157f06-87e0-496d-99f2-486957c07ac3]
110 X-Runtime: ['0.175062'] 201 X-Runtime: ['0.228299']
111 X-XSS-Protection: [1; mode=block] 202 X-XSS-Protection: [1; mode=block]
112 content-length: ['10481'] 203 content-length: ['12580']
113 status: {code: 200, message: OK} 204 status: {code: 200, message: OK}
114- request: 205- request:
115 body: null 206 body: null
@@ -121,13 +212,13 @@ interactions:
121 Content-Length: ['0'] 212 Content-Length: ['0']
122 User-Agent: [python-requests/2.18.4] 213 User-Agent: [python-requests/2.18.4]
123 method: DELETE 214 method: DELETE
124 uri: http://localhost:3000/api/v1/statuses/102003581864478788 215 uri: http://localhost:3000/api/v1/statuses/102003683512723982
125 response: 216 response:
126 body: {string: '{}'} 217 body: {string: '{}'}
127 headers: 218 headers:
128 Cache-Control: ['max-age=0, private, must-revalidate'] 219 Cache-Control: ['max-age=0, private, must-revalidate']
129 Content-Type: [application/json; charset=utf-8] 220 Content-Type: [application/json; charset=utf-8]
130 ETag: [W/"0f55e9de51b2e35f7a3eecdfab3e2571"] 221 ETag: [W/"35127b8d5250775810c927176b395efa"]
131 Referrer-Policy: [strict-origin-when-cross-origin] 222 Referrer-Policy: [strict-origin-when-cross-origin]
132 Transfer-Encoding: [chunked] 223 Transfer-Encoding: [chunked]
133 Vary: ['Accept-Encoding, Origin'] 224 Vary: ['Accept-Encoding, Origin']
@@ -135,8 +226,8 @@ interactions:
135 X-Download-Options: [noopen] 226 X-Download-Options: [noopen]
136 X-Frame-Options: [SAMEORIGIN] 227 X-Frame-Options: [SAMEORIGIN]
137 X-Permitted-Cross-Domain-Policies: [none] 228 X-Permitted-Cross-Domain-Policies: [none]
138 X-Request-Id: [e9e9ed92-a1c4-4bc7-ab9e-5e1a2df23660] 229 X-Request-Id: [dae42ec5-5ddc-401a-a9d1-b535e5d20a2e]
139 X-Runtime: ['0.024581'] 230 X-Runtime: ['0.037362']
140 X-XSS-Protection: [1; mode=block] 231 X-XSS-Protection: [1; mode=block]
141 content-length: ['2'] 232 content-length: ['2']
142 status: {code: 200, message: OK} 233 status: {code: 200, message: OK}
diff --git a/tests/test_timeline.py b/tests/test_timeline.py
index 3a75029..93ac8de 100644
--- a/tests/test_timeline.py
+++ b/tests/test_timeline.py
@@ -50,8 +50,12 @@ def test_conversations(api, api2):
50 status = api.status_post("@admin ilu bby ;3", visibility="direct") 50 status = api.status_post("@admin ilu bby ;3", visibility="direct")
51 time.sleep(2) 51 time.sleep(2)
52 conversations = api2.conversations() 52 conversations = api2.conversations()
53 api2.conversations_read(conversations[0])
54 time.sleep(2)
55 conversations2 = api2.conversations()
53 api.status_delete(status) 56 api.status_delete(status)
54 assert conversations 57 assert conversations
55 assert status.id in map(lambda x: x.last_status.id, conversations) 58 assert status.id in map(lambda x: x.last_status.id, conversations)
56 assert account.id in map(lambda x: x.accounts[0].id, conversations) 59 assert account.id in map(lambda x: x.accounts[0].id, conversations)
57 60 assert conversations[0].unread == True
61 assert conversations2[0].unread == False
Powered by cgit v1.2.3 (git 2.41.0)