Merge branch 'halcy:master' into master

This commit is contained in:
Aljoscha Rittner 2022-06-24 16:37:37 +02:00 cometido por GitHub
commit 7e0460ddcb
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 4AEE18F83AFDEB23
S'han modificat 4 arxius amb 421 adicions i 139 eliminacions

Veure arxiu

@ -1650,13 +1650,23 @@ class Mastodon:
# Reading data: Bookmarks # Reading data: Bookmarks
### ###
@api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS) @api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS)
def bookmarks(self): def bookmarks(self, max_id=None, min_id=None, since_id=None, limit=None):
""" """
Get a list of statuses bookmarked by the logged-in user. Get a list of statuses bookmarked by the logged-in user.
Returns a list of `toot dicts`_. Returns a list of `toot dicts`_.
""" """
return self.__api_request('GET', '/api/v1/bookmarks') if max_id != None:
max_id = self.__unpack_id(max_id)
if min_id != None:
min_id = self.__unpack_id(min_id)
if since_id != None:
since_id = self.__unpack_id(since_id)
params = self.__generate_params(locals())
return self.__api_request('GET', '/api/v1/bookmarks', params)
### ###
# Writing data: Statuses # Writing data: Statuses
@ -3247,7 +3257,7 @@ class Mastodon:
if (key in json_object and isinstance(json_object[key], six.text_type)): if (key in json_object and isinstance(json_object[key], six.text_type)):
if json_object[key].lower() == 'true': if json_object[key].lower() == 'true':
json_object[key] = True json_object[key] = True
if json_object[key].lower() == 'False': if json_object[key].lower() == 'false':
json_object[key] = False json_object[key] = False
return json_object return json_object

Veure arxiu

@ -26,7 +26,7 @@ This test suite uses [VCR.py][] to record requests to Mastodon and replay them i
If you want to add or change tests, you will need a Mastodon development server running on `http://localhost:3000`, with the default `admin` user and default password. If you want to add or change tests, you will need a Mastodon development server running on `http://localhost:3000`, with the default `admin` user and default password.
To set this up, follow the development guide and set up the database using "rails db:setup". To set this up, follow the development guide and set up the database using "rails db:setup".
It also needs a test OAuth app and an additional test user to be set up by applying the provided `setup.sql` to Mastodon's database: It also needs a test OAuth app-registriation and an additional test user to be set up by applying the provided `setup.sql` to Mastodon's database:
psql -d mastodon_development < tests/setup.sql psql -d mastodon_development < tests/setup.sql

Veure arxiu

@ -2,174 +2,441 @@ interactions:
- request: - request:
body: status=Toot%21 body: status=Toot%21
headers: headers:
Accept: ['*/*'] Accept:
Accept-Encoding: ['gzip, deflate'] - '*/*'
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] Accept-Encoding:
Connection: [keep-alive] - gzip, deflate
Content-Length: ['14'] Authorization:
Content-Type: [application/x-www-form-urlencoded] - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
User-Agent: [python-requests/2.18.4] Connection:
- keep-alive
Content-Length:
- '14'
Content-Type:
- application/x-www-form-urlencoded
User-Agent:
- python-requests/2.22.0
method: POST method: POST
uri: http://localhost:3000/api/v1/statuses uri: http://localhost:3000/api/v1/statuses
response: response:
body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py body:
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","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":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","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":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
headers: headers:
Cache-Control: ['no-cache, no-store'] Cache-Control:
Content-Type: [application/json; charset=utf-8] - no-store
Referrer-Policy: [strict-origin-when-cross-origin] Content-Security-Policy:
Transfer-Encoding: [chunked] - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
Vary: ['Accept-Encoding, Origin'] ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost;
X-Content-Type-Options: [nosniff] style-src ''self'' http://localhost ''nonce-s4DtHaGKm+Sv7S0opGjkuA==''; media-src
X-Download-Options: [noopen] ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src
X-Frame-Options: [SAMEORIGIN] ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost
X-Permitted-Cross-Domain-Policies: [none] http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035;
X-Request-Id: [4c259279-4810-4065-bda7-44fdd2e5e769] script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src
X-Runtime: ['0.160125'] ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost'
X-XSS-Protection: [1; mode=block] Content-Type:
content-length: ['1320'] - application/json; charset=utf-8
status: {code: 200, message: OK} ETag:
- W/"16c19c98c5667003bada6cc08d6a9efd"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Accept-Encoding, 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:
- '290'
X-RateLimit-Reset:
- '2022-06-24T15:00:00.156190Z'
X-Request-Id:
- a38516b7-de3e-4c49-9405-0bded1f29145
X-Runtime:
- '0.047610'
X-XSS-Protection:
- 1; mode=block
content-length:
- '1308'
status:
code: 200
message: OK
- request: - request:
body: null body: null
headers: headers:
Accept: ['*/*'] Accept:
Accept-Encoding: ['gzip, deflate'] - '*/*'
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] Accept-Encoding:
Connection: [keep-alive] - gzip, deflate
Content-Length: ['0'] Authorization:
User-Agent: [python-requests/2.18.4] - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- python-requests/2.22.0
method: POST method: POST
uri: http://localhost:3000/api/v1/statuses/103704183225122470/bookmark uri: http://localhost:3000/api/v1/statuses/108532515807337403/bookmark
response: response:
body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py body:
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","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":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","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":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
headers: headers:
Cache-Control: ['no-cache, no-store'] Cache-Control:
Content-Type: [application/json; charset=utf-8] - no-store
Referrer-Policy: [strict-origin-when-cross-origin] Content-Security-Policy:
Transfer-Encoding: [chunked] - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
Vary: ['Accept-Encoding, Origin'] ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost;
X-Content-Type-Options: [nosniff] style-src ''self'' http://localhost ''nonce-r/DodIkic+v9H9lAcksQVw==''; media-src
X-Download-Options: [noopen] ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src
X-Frame-Options: [SAMEORIGIN] ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost
X-Permitted-Cross-Domain-Policies: [none] http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035;
X-Request-Id: [a0ef24c0-bc8d-45ef-80af-0737f40f4191] script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src
X-Runtime: ['0.157864'] ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost'
X-XSS-Protection: [1; mode=block] Content-Type:
content-length: ['1319'] - application/json; charset=utf-8
status: {code: 200, message: OK} ETag:
- W/"bb1e121980e105d13ea65b61a8fe3f9e"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Accept-Encoding, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- 4af13637-38f4-41d6-ad47-756de2626bf3
X-Runtime:
- '0.041993'
X-XSS-Protection:
- 1; mode=block
content-length:
- '1307'
status:
code: 200
message: OK
- request: - request:
body: null body: null
headers: headers:
Accept: ['*/*'] Accept:
Accept-Encoding: ['gzip, deflate'] - '*/*'
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] Accept-Encoding:
Connection: [keep-alive] - gzip, deflate
User-Agent: [python-requests/2.18.4] Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
Connection:
- keep-alive
User-Agent:
- python-requests/2.22.0
method: GET method: GET
uri: http://localhost:3000/api/v1/bookmarks uri: http://localhost:3000/api/v1/bookmarks
response: response:
body: {string: '[{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py body:
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","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":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]'} string: '[{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","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":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]'
headers: headers:
Cache-Control: ['no-cache, no-store'] Cache-Control:
Content-Type: [application/json; charset=utf-8] - no-store
Link: ['<http://localhost:3000/api/v1/bookmarks?min_id=2>; rel="prev"'] Content-Security-Policy:
Referrer-Policy: [strict-origin-when-cross-origin] - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
Transfer-Encoding: [chunked] ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost;
Vary: ['Accept-Encoding, Origin'] style-src ''self'' http://localhost ''nonce-EEFQZtT2hj45UYMa5FifxA==''; media-src
X-Content-Type-Options: [nosniff] ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src
X-Download-Options: [noopen] ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost
X-Frame-Options: [SAMEORIGIN] http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035;
X-Permitted-Cross-Domain-Policies: [none] script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src
X-Request-Id: [e6548f1e-3d17-46be-aca7-f310783119a8] ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost'
X-Runtime: ['0.075518'] Content-Type:
X-XSS-Protection: [1; mode=block] - application/json; charset=utf-8
content-length: ['1321'] ETag:
status: {code: 200, message: OK} - W/"e28cea671d77758e8cd2652347a030d1"
Link:
- <http://localhost:3000/api/v1/bookmarks?min_id=11>; rel="prev"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Accept-Encoding, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- 0fe7aaf8-add4-4523-a98f-22608f714cad
X-Runtime:
- '0.036771'
X-XSS-Protection:
- 1; mode=block
content-length:
- '1309'
status:
code: 200
message: OK
- request: - request:
body: null body: null
headers: headers:
Accept: ['*/*'] Accept:
Accept-Encoding: ['gzip, deflate'] - '*/*'
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] Accept-Encoding:
Connection: [keep-alive] - gzip, deflate
Content-Length: ['0'] Authorization:
User-Agent: [python-requests/2.18.4] - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
method: POST Connection:
uri: http://localhost:3000/api/v1/statuses/103704183225122470/unbookmark - keep-alive
User-Agent:
- python-requests/2.22.0
method: GET
uri: http://localhost:3000/api/v1/bookmarks?limit=1
response: response:
body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py body:
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","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":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} string: '[{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","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":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]'
headers: headers:
Cache-Control: ['no-cache, no-store'] Cache-Control:
Content-Type: [application/json; charset=utf-8] - no-store
Referrer-Policy: [strict-origin-when-cross-origin] Content-Security-Policy:
Transfer-Encoding: [chunked] - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
Vary: ['Accept-Encoding, Origin'] ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost;
X-Content-Type-Options: [nosniff] style-src ''self'' http://localhost ''nonce-wzGUumpjXwVRz6YQjB+AhQ==''; media-src
X-Download-Options: [noopen] ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src
X-Frame-Options: [SAMEORIGIN] ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost
X-Permitted-Cross-Domain-Policies: [none] http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035;
X-Request-Id: [d9792c38-ab1e-46de-9737-704433ad8f94] script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src
X-Runtime: ['0.095876'] ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost'
X-XSS-Protection: [1; mode=block] Content-Type:
content-length: ['1320'] - application/json; charset=utf-8
status: {code: 200, message: OK} ETag:
- W/"e28cea671d77758e8cd2652347a030d1"
Link:
- <http://localhost:3000/api/v1/bookmarks?limit=1&max_id=11>; rel="next", <http://localhost:3000/api/v1/bookmarks?limit=1&min_id=11>;
rel="prev"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Accept-Encoding, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- 7c887921-a7ee-478d-8e68-61359f4eacaf
X-Runtime:
- '0.037690'
X-XSS-Protection:
- 1; mode=block
content-length:
- '1309'
status:
code: 200
message: OK
- request: - request:
body: null body: null
headers: headers:
Accept: ['*/*'] Accept:
Accept-Encoding: ['gzip, deflate'] - '*/*'
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] Accept-Encoding:
Connection: [keep-alive] - gzip, deflate
User-Agent: [python-requests/2.18.4] Authorization:
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- python-requests/2.22.0
method: POST
uri: http://localhost:3000/api/v1/statuses/108532515807337403/unbookmark
response:
body:
string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","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":1,"last_status_at":"2022-06-24","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; img-src ''self'' https: data: blob: http://localhost;
style-src ''self'' http://localhost ''nonce-x2CjCkxjnkvgJiPtS/CoIg==''; media-src
''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src
''self'' http://localhost; connect-src ''self'' data: blob: http://localhost
http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035;
script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src
''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost'
Content-Type:
- application/json; charset=utf-8
ETag:
- W/"16c19c98c5667003bada6cc08d6a9efd"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Accept-Encoding, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- 61142a88-6453-47c6-8230-6b6196efb64c
X-Runtime:
- '0.035340'
X-XSS-Protection:
- 1; mode=block
content-length:
- '1308'
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:
- python-requests/2.22.0
method: GET method: GET
uri: http://localhost:3000/api/v1/bookmarks uri: http://localhost:3000/api/v1/bookmarks
response: response:
body: {string: '[]'} body:
string: '[]'
headers: headers:
Cache-Control: ['no-cache, no-store'] Cache-Control:
Content-Type: [application/json; charset=utf-8] - no-store
Referrer-Policy: [strict-origin-when-cross-origin] Content-Security-Policy:
Transfer-Encoding: [chunked] - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
Vary: ['Accept-Encoding, Origin'] ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost;
X-Content-Type-Options: [nosniff] style-src ''self'' http://localhost ''nonce-i6oSjmQ5IE8wtOR+vDrGZw==''; media-src
X-Download-Options: [noopen] ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src
X-Frame-Options: [SAMEORIGIN] ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost
X-Permitted-Cross-Domain-Policies: [none] http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035;
X-Request-Id: [8454c5ef-5f23-43b9-89d8-dc1b1605f7ac] script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src
X-Runtime: ['0.035375'] ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost'
X-XSS-Protection: [1; mode=block] Content-Type:
content-length: ['2'] - application/json; charset=utf-8
status: {code: 200, message: OK} ETag:
- W/"aaa12070e167024a89ca985596a44579"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Accept-Encoding, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- 639bbb25-65a5-44eb-a886-d7092f891ecb
X-Runtime:
- '0.014781'
X-XSS-Protection:
- 1; mode=block
content-length:
- '2'
status:
code: 200
message: OK
- request: - request:
body: null body: null
headers: headers:
Accept: ['*/*'] Accept:
Accept-Encoding: ['gzip, deflate'] - '*/*'
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] Accept-Encoding:
Connection: [keep-alive] - gzip, deflate
Content-Length: ['0'] Authorization:
User-Agent: [python-requests/2.18.4] - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- python-requests/2.22.0
method: DELETE method: DELETE
uri: http://localhost:3000/api/v1/statuses/103704183225122470 uri: http://localhost:3000/api/v1/statuses/108532515807337403
response: response:
body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot!","reblog":null,"application":{"name":"Mastodon.py body:
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","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":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot!","reblog":null,"application":{"name":"Mastodon.py
test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","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":0,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
headers: headers:
Cache-Control: ['no-cache, no-store'] Cache-Control:
Content-Type: [application/json; charset=utf-8] - no-store
Referrer-Policy: [strict-origin-when-cross-origin] Content-Security-Policy:
Transfer-Encoding: [chunked] - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
Vary: ['Accept-Encoding, Origin'] ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost;
X-Content-Type-Options: [nosniff] style-src ''self'' http://localhost ''nonce-9ZHC6oHcDEPPkskChbQjOQ==''; media-src
X-Download-Options: [noopen] ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src
X-Frame-Options: [SAMEORIGIN] ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost
X-Permitted-Cross-Domain-Policies: [none] http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035;
X-Request-Id: [c222a2ef-6671-4d1c-97be-0a4e2b2f6a14] script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src
X-Runtime: ['0.122283'] ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost'
X-XSS-Protection: [1; mode=block] Content-Type:
content-length: ['1290'] - application/json; charset=utf-8
status: {code: 200, message: OK} ETag:
- W/"efc9742f5a2c445d981fd8b15ed77122"
Referrer-Policy:
- strict-origin-when-cross-origin
Transfer-Encoding:
- chunked
Vary:
- Accept, Accept-Encoding, Origin
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Request-Id:
- 1ca08d80-70b4-4aa9-abfe-5ca3286f63b8
X-Runtime:
- '0.037653'
X-XSS-Protection:
- 1; mode=block
content-length:
- '1278'
status:
code: 200
message: OK
version: 1 version: 1

Veure arxiu

@ -11,6 +11,11 @@ def test_bookmarks(api, status):
assert len(bookmarked_statuses) > 0 assert len(bookmarked_statuses) > 0
assert status_bookmarked == bookmarked_statuses[0] assert status_bookmarked == bookmarked_statuses[0]
bookmarked_statuses = api.bookmarks(limit=1)
assert bookmarked_statuses
assert len(bookmarked_statuses) > 0
assert status_bookmarked == bookmarked_statuses[0]
status_unbookmarked = api.status_unbookmark(status_bookmarked) status_unbookmarked = api.status_unbookmark(status_bookmarked)
assert status_unbookmarked assert status_unbookmarked
assert status_unbookmarked.bookmarked == False assert status_unbookmarked.bookmarked == False