From 750527416f4607b38415fa405e85876578dda05e Mon Sep 17 00:00:00 2001 From: halcy Date: Sun, 13 Nov 2022 14:22:43 +0200 Subject: Add account notes --- tests/cassettes/test_account_notes.yaml | 123 ++++++++++++++++++++++++++++++++ tests/test_account.py | 27 ++----- 2 files changed, 128 insertions(+), 22 deletions(-) create mode 100644 tests/cassettes/test_account_notes.yaml (limited to 'tests') diff --git a/tests/cassettes/test_account_notes.yaml b/tests/cassettes/test_account_notes.yaml new file mode 100644 index 0000000..275514c --- /dev/null +++ b/tests/cassettes/test_account_notes.yaml @@ -0,0 +1,123 @@ +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":"109336199753389764","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":0,"last_status_at":null,"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-TRItETB4W72vy3k5XQZRAA==''; + 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/"a576b865af5fce00b4019a62d9c55f75" + 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: + - 53684e14-3054-47ec-aa8f-7450b0c38056 + X-Runtime: + - '0.025567' + X-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: comment=top+ebayer+gerne+wieder + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN + Connection: + - keep-alive + Content-Length: + - '31' + Content-Type: + - application/x-www-form-urlencoded + User-Agent: + - tests/v311 + method: POST + uri: http://localhost:3000/api/v1/accounts/109336199753389764/note + response: + body: + string: '{"id":"109336199753389764","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-3t+BKMJ4b8EcyKFsQ7MZOg==''; + 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/"c3ead4efc220cb74679970c3bb3bd0cf" + 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: + - 91546468-a591-49ad-ac52-f2c5ab510161 + X-Runtime: + - '0.037352' + X-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_account.py b/tests/test_account.py index 6584dbc..ef48d4e 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -233,26 +233,9 @@ def test_suggested_tags(api): @pytest.mark.vcr() def test_featured_tags(api): featured_tag = api.featured_tag_create("ringtones") - """try: - status = api.status_post("cool free #ringtones") - time.sleep(2) - featured_tag = api.featured_tag_create("ringtones") - assert featured_tag - - tag_list = api.featured_tags() - assert featured_tag.name in list(map(lambda x: x.name, tag_list)) - - api.featured_tag_delete(featured_tag) - tag_list = api.featured_tags() - assert not featured_tag.name in list(map(lambda x: x.name, tag_list)) - finally: - api.status_delete(status)""" - - - - - - - - +@pytest.mark.vcr() +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" -- cgit v1.2.3