Add support and tests for "notifying" follow

pull/257/head
halcy 2022-11-13 16:02:34 +02:00
rodzic b1e1ec7bdc
commit c66015a6b0
6 zmienionych plików z 692 dodań i 8 usunięć

Wyświetl plik

@ -20,8 +20,8 @@ Refer to mastodon changelog and API docs for details when implementing, add or m
3.3.0
-----
* [ ] Add option to be notified when a followed user posts
* [ ] Add duration option to the mute function
* [x] Add option to be notified when a followed user posts
* [x] Add duration option to the mute function
* [ ] Add ability to block access or limit sign-ups from chosen IPs
* [ ] Add support for managing multiple stream subscriptions in a single connection
* [x] Add support for limiting results by both min_id and max_id at the same time in REST API

Wyświetl plik

@ -496,6 +496,7 @@ Relationship dicts
'endorsed': # Boolean denoting wheter the specified user is being endorsed / featured by the
# logged-in user
'note': # A free text note the logged in user has created for this account (not publicly visible)
'notifying' # Boolean denoting whether the logged-in user has requested to get notified every time the followed user posts
}
Filter dicts

Wyświetl plik

@ -215,7 +215,7 @@ class Mastodon:
__DICT_VERSION_INSTANCE = bigger_version("3.1.4", __DICT_VERSION_ACCOUNT)
__DICT_VERSION_HASHTAG = "2.3.4"
__DICT_VERSION_EMOJI = "3.0.0"
__DICT_VERSION_RELATIONSHIP = "3.2.0"
__DICT_VERSION_RELATIONSHIP = "3.3.0"
__DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS)
__DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS)
__DICT_VERSION_LIST = "2.1.0"
@ -2098,12 +2098,13 @@ class Mastodon:
###
# Writing data: Accounts
###
@api_version("1.0.0", "2.4.3", __DICT_VERSION_RELATIONSHIP)
def account_follow(self, id, reblogs=True):
@api_version("1.0.0", "3.3.0", __DICT_VERSION_RELATIONSHIP)
def account_follow(self, id, reblogs=True, notify=False):
"""
Follow a user.
Set `reblogs` to False to hide boosts by the followed user.
Set `notify` to True to get a notification every time the followed user posts.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""

Wyświetl plik

@ -0,0 +1,665 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
Connection:
- keep-alive
User-Agent:
- tests/v311
method: GET
uri: http://localhost:3000/api/v1/accounts/verify_credentials
response:
body:
string: '{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":5,"last_status_at":"2022-11-13","noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-uS7exBS4RMpfA9zKIho8og=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"c8b7fdcc68fcea8c85022735def25829"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- ab22558b-169c-4a41-ab51-c1eaae565a1b
X-Runtime:
- '0.012066'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: id=109336623096259500&reblogs=0&notify=1
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
Connection:
- keep-alive
Content-Length:
- '40'
Content-Type:
- application/x-www-form-urlencoded
User-Agent:
- tests/v311
method: POST
uri: http://localhost:3000/api/v1/accounts/109336623096259500/follow
response:
body:
string: '{"id":"109336623096259500","following":true,"showing_reblogs":false,"notifying":true,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":"top
ebayer gerne wieder"}'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-YRtCuk4cER3IJ4KAPZQMjQ=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"99777c022aac4553e95b89fa7d1cdf52"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-RateLimit-Limit:
- '400'
X-RateLimit-Remaining:
- '391'
X-RateLimit-Reset:
- '2022-11-14T00:00:00.902637Z'
X-Request-Id:
- f6c76e22-8885-4f41-a189-1896ded56c01
X-Runtime:
- '0.021815'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: status=rootin+tooting+and+shootin
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_3
Connection:
- keep-alive
Content-Length:
- '33'
Content-Type:
- application/x-www-form-urlencoded
User-Agent:
- tests/v311
method: POST
uri: http://localhost:3000/api/v1/statuses
response:
body:
string: '{"id":"109336852163356113","created_at":"2022-11-13T13:59:23.919Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test_2/statuses/109336852163356113","url":"http://localhost:3000/@mastodonpy_test_2/109336852163356113","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003erootin
tooting and shootin\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623415600158","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-rJtmP520teUmbAS31nwZfw=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"3df7b27876a5ccabcf05f1c9995ad0ab"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-RateLimit-Limit:
- '300'
X-RateLimit-Remaining:
- '296'
X-RateLimit-Reset:
- '2022-11-13T15:00:00.940930Z'
X-Request-Id:
- fdfa666a-885c-4d77-82d9-81cbbfeb5813
X-Runtime:
- '0.033721'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: status=horses+are+not+real
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
Connection:
- keep-alive
Content-Length:
- '26'
Content-Type:
- application/x-www-form-urlencoded
User-Agent:
- tests/v311
method: POST
uri: http://localhost:3000/api/v1/statuses
response:
body:
string: '{"id":"109336852231439258","created_at":"2022-11-13T13:59:24.958Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336852231439258","url":"http://localhost:3000/@admin/109336852231439258","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003ehorses
are not real\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":6,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-aP5ZepJpFHR7Qp5sH/saGA=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"77a7a384e480a6e8fe96f15dd6aba687"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-RateLimit-Limit:
- '300'
X-RateLimit-Remaining:
- '276'
X-RateLimit-Reset:
- '2022-11-13T15:00:00.986554Z'
X-Request-Id:
- 17e5f05b-cd90-4b86-84c0-809056fab257
X-Runtime:
- '0.039939'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- tests/v311
method: POST
uri: http://localhost:3000/api/v1/statuses/109336852163356113/reblog
response:
body:
string: '{"id":"109336852234411327","created_at":"2022-11-13T13:59:25.003Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":null,"uri":"http://localhost:3000/users/admin/statuses/109336852234411327/activity","url":"http://localhost:3000/users/admin/statuses/109336852234411327/activity","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":true,"muted":false,"bookmarked":false,"content":"","filtered":[],"reblog":{"id":"109336852163356113","created_at":"2022-11-13T13:59:23.919Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test_2/statuses/109336852163356113","url":"http://localhost:3000/@mastodonpy_test_2/109336852163356113","replies_count":0,"reblogs_count":1,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":true,"muted":false,"bookmarked":false,"content":"\u003cp\u003erootin
tooting and shootin\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623415600158","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},"application":null,"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-7iO8oD4GFiOLby+H0bj0yw=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"7cffc8e25d18ffb7b9691c7217ac8c68"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-RateLimit-Limit:
- '300'
X-RateLimit-Remaining:
- '276'
X-RateLimit-Reset:
- '2022-11-13T15:00:00.036550Z'
X-Request-Id:
- e42fafef-bd21-4bf5-b53e-6d6b2e53b432
X-Runtime:
- '0.046112'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
Connection:
- keep-alive
User-Agent:
- tests/v311
method: GET
uri: http://localhost:3000/api/v1/notifications
response:
body:
string: '[{"id":"29","type":"status","created_at":"2022-11-13T13:59:25.305Z","account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"status":{"id":"109336852231439258","created_at":"2022-11-13T13:59:24.958Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336852231439258","url":"http://localhost:3000/@admin/109336852231439258","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003ehorses
are not real\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}},{"id":"26","type":"status","created_at":"2022-11-13T13:56:44.958Z","account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"status":{"id":"109336841715165741","created_at":"2022-11-13T13:56:44.492Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336841715165741","url":"http://localhost:3000/@admin/109336841715165741","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003ehorses
are not real\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}}]'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-PR0gTQK+R6rN1/fgM1tpwQ=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"45c835cacac6df44f95efa217d690ad8"
Link:
- <http://localhost:3000/api/v1/notifications?max_id=26>; rel="next", <http://localhost:3000/api/v1/notifications?min_id=29>;
rel="prev"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- ab9997d3-c930-4335-a839-718930776e17
X-Runtime:
- '0.027844'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
Connection:
- keep-alive
User-Agent:
- tests/v311
method: GET
uri: http://localhost:3000/api/v1/timelines/home?local=1
response:
body:
string: '[{"id":"109336852231439258","created_at":"2022-11-13T13:59:24.958Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336852231439258","url":"http://localhost:3000/@admin/109336852231439258","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003ehorses
are not real\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"109336841715165741","created_at":"2022-11-13T13:56:44.492Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336841715165741","url":"http://localhost:3000/@admin/109336841715165741","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003ehorses
are not real\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"109336682422462377","created_at":"2022-11-13T13:16:13.878Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109336682422462377","url":"http://localhost:3000/@mastodonpy_test/109336682422462377","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eit\u0026#39;s
cool guy\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623311102204","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John
Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"\u003cp\u003eI
walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/336/623/311/102/204/original/8f758332953652da.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/336/623/311/102/204/original/8f758332953652da.jpg","header":"http://localhost:3000/system/accounts/headers/109/336/623/311/102/204/original/c7470bf076df1e55.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/336/623/311/102/204/original/c7470bf076df1e55.jpg","followers_count":0,"following_count":1,"statuses_count":3,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"109336681112255813","created_at":"2022-11-13T13:15:53.886Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336681112255813","url":"http://localhost:3000/@admin/109336681112255813","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003eon
the internet, nobody knows you\u0026#39;re a plane\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"109336681109577944","created_at":"2022-11-13T13:15:53.845Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336681109577944","url":"http://localhost:3000/@admin/109336681109577944","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003e\u003cspan
class=\"h-card\"\u003e\u003ca href=\"http://localhost:3000/@mastodonpy_test\"
class=\"u-url mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
beep beep I\u0026#39;m a jeep\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"109336623311102204","username":"mastodonpy_test","url":"http://localhost:3000/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"109336679609194893","created_at":"2022-11-13T13:15:30.952Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336679609194893","url":"http://localhost:3000/@admin/109336679609194893","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003enice\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":1,"following_count":0,"statuses_count":7,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":{"id":"2","expires_at":"2022-11-13T13:20:30.950Z","expired":true,"multiple":false,"votes_count":1,"voters_count":1,"voted":true,"own_votes":[1],"options":[{"title":"four
twenty","votes_count":0},{"title":"sixty-nine","votes_count":1}],"emojis":[]}}]'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-n91C5SphlprktCg4bDV0sw=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"a18ef2c9f24ad454649334c88e6cceb9"
Link:
- <http://localhost:3000/api/v1/timelines/home?local=1&max_id=109336679609194893>;
rel="next", <http://localhost:3000/api/v1/timelines/home?local=1&min_id=109336852231439258>;
rel="prev"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- de3b2050-3b00-405c-8cb6-bd9dd4e32e2b
X-Runtime:
- '0.043971'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- tests/v311
method: POST
uri: http://localhost:3000/api/v1/accounts/109336623096259500/unfollow
response:
body:
string: '{"id":"109336623096259500","following":false,"showing_reblogs":false,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":"top
ebayer gerne wieder"}'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-7W6NkyJEvQmKfbFEyMxwIA=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"fc5fa4da9317772baa3b6968b8c31a68"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- f07c1479-112a-44f3-b83c-930d38ac996a
X-Runtime:
- '0.025638'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_3
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- tests/v311
method: DELETE
uri: http://localhost:3000/api/v1/statuses/109336852163356113
response:
body:
string: '{"id":"109336852163356113","created_at":"2022-11-13T13:59:23.919Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test_2/statuses/109336852163356113","url":"http://localhost:3000/@mastodonpy_test_2/109336852163356113","replies_count":0,"reblogs_count":1,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"rootin
tooting and shootin","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623415600158","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-rgsUEdBX+2TXJ9j1b5NHYg=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"bd5e476d8c6115f0b6ce3dff05cd0b60"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- 703899a3-bbae-429f-bd33-be2d0871c956
X-Runtime:
- '0.033619'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- tests/v311
method: DELETE
uri: http://localhost:3000/api/v1/statuses/109336852231439258
response:
body:
string: '{"id":"109336852231439258","created_at":"2022-11-13T13:59:24.958Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109336852231439258","url":"http://localhost:3000/@admin/109336852231439258","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"horses
are not real","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"109336623096259500","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":6,"last_status_at":"2022-11-13","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
headers:
Cache-Control:
- no-store
Content-Security-Policy:
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
style-src ''self'' http://localhost:3000 ''nonce-4awjPWzvNj9LOfWzGDa3ZQ=='';
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
worker-src ''self'' blob: http://localhost:3000'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"6e6949a2db62d405d6a519d84d2e8ae3"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- 56b22297-c29c-470c-a85f-9d386d75889f
X-Runtime:
- '0.024267'
X-XSS-Protection:
- 1; mode=block
status:
code: 200
message: OK
version: 1

Wyświetl plik

@ -69,7 +69,6 @@ def test_account_follow_unfollow(api, api2):
assert relationship
assert not relationship['following']
@pytest.mark.vcr()
def test_account_block_unblock(api, api2):
api2_id = api2.account_verify_credentials().id
@ -82,7 +81,6 @@ def test_account_block_unblock(api, api2):
assert relationship
assert not relationship['blocking']
@pytest.mark.vcr()
def test_account_mute_unmute(api, api2):
api2_id = api2.account_verify_credentials().id
@ -110,7 +108,6 @@ def test_blocks(api):
blocks = api.blocks()
assert isinstance(blocks, list)
@pytest.mark.vcr(match_on=['path'])
def test_account_update_credentials(api):
with open('tests/image.jpg', 'rb') as f:
@ -264,3 +261,22 @@ def test_account_notes(api, api2):
relationship = api.account_note_set(api2.account_verify_credentials(), "top ebayer gerne wieder")
assert relationship
assert relationship.note == "top ebayer gerne wieder"
@pytest.mark.vcr()
def test_follow_with_notify_reblog(api, api2, api3):
api2_id = api2.account_verify_credentials()
try:
api.account_follow(api2_id, notify = True, reblogs = False)
status1 = api3.toot("rootin tooting and shootin")
time.sleep(1)
status2 = api2.toot("horses are not real")
api2.status_reblog(status1)
time.sleep(3)
notifications = api.notifications()
timeline = api.timeline(local=True)
assert timeline[0].id == status2.id
assert notifications[0].status.id == status2.id
finally:
api.account_unfollow(api2_id)
api3.status_delete(status1)
api2.status_delete(status2)

Wyświetl plik

@ -34,3 +34,4 @@ def test_notifications_dismiss_pre_2_9_2(api, api2):
@pytest.mark.vcr()
def test_notifications_clear(api):
api.notifications_clear()