From f421b1e4984e1811153032cb56e8fd191a0e6307 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sat, 12 Oct 2019 20:13:38 +0200 Subject: Add new parameter for search --- tests/cassettes/test_search.yaml | 22 +++++++++++----------- tests/test_search.py | 3 +++ 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/cassettes/test_search.yaml b/tests/cassettes/test_search.yaml index 56453b3..bbb88f0 100644 --- a/tests/cassettes/test_search.yaml +++ b/tests/cassettes/test_search.yaml @@ -8,9 +8,9 @@ interactions: Connection: [keep-alive] User-Agent: [python-requests/2.18.4] method: GET - uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test + uri: http://localhost:3000/api/v2/search?exclude_unreviewed=1&resolve=1&q=mastodonpy_test response: - body: {string: '{"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T23:11:52.441Z","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":2,"last_status_at":"2019-10-11T21:49:22.805Z","emojis":[],"fields":[]},{"id":"1234567890123457","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":true,"bot":false,"created_at":"2019-06-22T23:11:52.445Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test_2","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":null,"emojis":[],"fields":[]}],"statuses":[],"hashtags":[]}'} + body: {string: '{"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T23:11:52.441Z","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":1,"statuses_count":2,"last_status_at":"2019-10-11T21:50:54.637Z","emojis":[],"fields":[]},{"id":"1234567890123457","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":true,"bot":false,"created_at":"2019-06-22T23:11:52.445Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test_2","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":null,"emojis":[],"fields":[]}],"statuses":[],"hashtags":[]}'} headers: Cache-Control: ['no-cache, no-store'] Content-Type: [application/json; charset=utf-8] @@ -21,8 +21,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [4ed49a56-2ee0-489c-822a-135ba9c9203e] - X-Runtime: ['0.028978'] + X-Request-Id: [e3981344-186b-487f-9ac5-1195c31679c7] + X-Runtime: ['0.031916'] X-XSS-Protection: [1; mode=block] content-length: ['1251'] status: {code: 200, message: OK} @@ -35,9 +35,9 @@ interactions: Connection: [keep-alive] User-Agent: [python-requests/2.18.4] method: GET - uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test + uri: http://localhost:3000/api/v2/search?exclude_unreviewed=1&resolve=1&q=mastodonpy_test response: - body: {string: '{"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T23:11:52.441Z","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":2,"last_status_at":"2019-10-11T21:49:22.805Z","emojis":[],"fields":[]},{"id":"1234567890123457","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":true,"bot":false,"created_at":"2019-06-22T23:11:52.445Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test_2","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":null,"emojis":[],"fields":[]}],"statuses":[],"hashtags":[]}'} + body: {string: '{"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"created_at":"2019-06-22T23:11:52.441Z","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":1,"statuses_count":2,"last_status_at":"2019-10-11T21:50:54.637Z","emojis":[],"fields":[]},{"id":"1234567890123457","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":true,"bot":false,"created_at":"2019-06-22T23:11:52.445Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test_2","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":null,"emojis":[],"fields":[]}],"statuses":[],"hashtags":[]}'} headers: Cache-Control: ['no-cache, no-store'] Content-Type: [application/json; charset=utf-8] @@ -48,8 +48,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [b9c4a547-27f6-4b55-9830-73a4e65d55da] - X-Runtime: ['0.026422'] + X-Request-Id: [5e62a49c-ac34-4759-8265-ffee054f1ca2] + X-Runtime: ['0.024392'] X-XSS-Protection: [1; mode=block] content-length: ['1251'] status: {code: 200, message: OK} @@ -62,7 +62,7 @@ interactions: Connection: [keep-alive] User-Agent: [python-requests/2.18.4] method: GET - uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test&type=statuses + uri: http://localhost:3000/api/v2/search?exclude_unreviewed=1&resolve=1&q=mastodonpy_test&type=statuses response: body: {string: '{"accounts":[],"statuses":[],"hashtags":[]}'} headers: @@ -75,8 +75,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [bea1135c-ef57-4e75-bbeb-c472c77273b6] - X-Runtime: ['0.016913'] + X-Request-Id: [10deaa1f-2a07-40d0-ab06-cbd50df93eb7] + X-Runtime: ['0.017407'] X-XSS-Protection: [1; mode=block] content-length: ['43'] status: {code: 200, message: OK} diff --git a/tests/test_search.py b/tests/test_search.py index a8ab33a..19d2ad4 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -15,6 +15,9 @@ def test_search(api): assert len(results["accounts"]) == 0 def test_search_pre_2_9_2(api): + api.mastodon_major = 2 + api.mastodon_minor = 9 + api.mastodon_patch = 1 with vcr.use_cassette('test_search.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'): results = api.search_v1('mastodonpy_test') assert isinstance(results, dict) -- cgit v1.2.3