aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-10-12 20:13:38 +0200
committerLorenz Diener <[email protected]>2019-10-12 20:13:38 +0200
commitf421b1e4984e1811153032cb56e8fd191a0e6307 (patch)
treefa33433139c06563426246bee1bc38be1ae12ef6 /tests
parent0b952aef124af09b6ea1267aac48bea6fc12f710 (diff)
downloadmastodon.py-f421b1e4984e1811153032cb56e8fd191a0e6307.tar.gz
Add new parameter for search
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_search.yaml22
-rw-r--r--tests/test_search.py3
2 files changed, 14 insertions, 11 deletions
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:
8 Connection: [keep-alive] 8 Connection: [keep-alive]
9 User-Agent: [python-requests/2.18.4] 9 User-Agent: [python-requests/2.18.4]
10 method: GET 10 method: GET
11 uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test 11 uri: http://localhost:3000/api/v2/search?exclude_unreviewed=1&resolve=1&q=mastodonpy_test
12 response: 12 response:
13 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":[]}'} 13 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":[]}'}
14 headers: 14 headers:
15 Cache-Control: ['no-cache, no-store'] 15 Cache-Control: ['no-cache, no-store']
16 Content-Type: [application/json; charset=utf-8] 16 Content-Type: [application/json; charset=utf-8]
@@ -21,8 +21,8 @@ interactions:
21 X-Download-Options: [noopen] 21 X-Download-Options: [noopen]
22 X-Frame-Options: [SAMEORIGIN] 22 X-Frame-Options: [SAMEORIGIN]
23 X-Permitted-Cross-Domain-Policies: [none] 23 X-Permitted-Cross-Domain-Policies: [none]
24 X-Request-Id: [4ed49a56-2ee0-489c-822a-135ba9c9203e] 24 X-Request-Id: [e3981344-186b-487f-9ac5-1195c31679c7]
25 X-Runtime: ['0.028978'] 25 X-Runtime: ['0.031916']
26 X-XSS-Protection: [1; mode=block] 26 X-XSS-Protection: [1; mode=block]
27 content-length: ['1251'] 27 content-length: ['1251']
28 status: {code: 200, message: OK} 28 status: {code: 200, message: OK}
@@ -35,9 +35,9 @@ interactions:
35 Connection: [keep-alive] 35 Connection: [keep-alive]
36 User-Agent: [python-requests/2.18.4] 36 User-Agent: [python-requests/2.18.4]
37 method: GET 37 method: GET
38 uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test 38 uri: http://localhost:3000/api/v2/search?exclude_unreviewed=1&resolve=1&q=mastodonpy_test
39 response: 39 response:
40 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":[]}'} 40 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":[]}'}
41 headers: 41 headers:
42 Cache-Control: ['no-cache, no-store'] 42 Cache-Control: ['no-cache, no-store']
43 Content-Type: [application/json; charset=utf-8] 43 Content-Type: [application/json; charset=utf-8]
@@ -48,8 +48,8 @@ interactions:
48 X-Download-Options: [noopen] 48 X-Download-Options: [noopen]
49 X-Frame-Options: [SAMEORIGIN] 49 X-Frame-Options: [SAMEORIGIN]
50 X-Permitted-Cross-Domain-Policies: [none] 50 X-Permitted-Cross-Domain-Policies: [none]
51 X-Request-Id: [b9c4a547-27f6-4b55-9830-73a4e65d55da] 51 X-Request-Id: [5e62a49c-ac34-4759-8265-ffee054f1ca2]
52 X-Runtime: ['0.026422'] 52 X-Runtime: ['0.024392']
53 X-XSS-Protection: [1; mode=block] 53 X-XSS-Protection: [1; mode=block]
54 content-length: ['1251'] 54 content-length: ['1251']
55 status: {code: 200, message: OK} 55 status: {code: 200, message: OK}
@@ -62,7 +62,7 @@ interactions:
62 Connection: [keep-alive] 62 Connection: [keep-alive]
63 User-Agent: [python-requests/2.18.4] 63 User-Agent: [python-requests/2.18.4]
64 method: GET 64 method: GET
65 uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test&type=statuses 65 uri: http://localhost:3000/api/v2/search?exclude_unreviewed=1&resolve=1&q=mastodonpy_test&type=statuses
66 response: 66 response:
67 body: {string: '{"accounts":[],"statuses":[],"hashtags":[]}'} 67 body: {string: '{"accounts":[],"statuses":[],"hashtags":[]}'}
68 headers: 68 headers:
@@ -75,8 +75,8 @@ interactions:
75 X-Download-Options: [noopen] 75 X-Download-Options: [noopen]
76 X-Frame-Options: [SAMEORIGIN] 76 X-Frame-Options: [SAMEORIGIN]
77 X-Permitted-Cross-Domain-Policies: [none] 77 X-Permitted-Cross-Domain-Policies: [none]
78 X-Request-Id: [bea1135c-ef57-4e75-bbeb-c472c77273b6] 78 X-Request-Id: [10deaa1f-2a07-40d0-ab06-cbd50df93eb7]
79 X-Runtime: ['0.016913'] 79 X-Runtime: ['0.017407']
80 X-XSS-Protection: [1; mode=block] 80 X-XSS-Protection: [1; mode=block]
81 content-length: ['43'] 81 content-length: ['43']
82 status: {code: 200, message: OK} 82 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):
15 assert len(results["accounts"]) == 0 15 assert len(results["accounts"]) == 0
16 16
17def test_search_pre_2_9_2(api): 17def test_search_pre_2_9_2(api):
18 api.mastodon_major = 2
19 api.mastodon_minor = 9
20 api.mastodon_patch = 1
18 with vcr.use_cassette('test_search.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'): 21 with vcr.use_cassette('test_search.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'):
19 results = api.search_v1('mastodonpy_test') 22 results = api.search_v1('mastodonpy_test')
20 assert isinstance(results, dict) 23 assert isinstance(results, dict)
Powered by cgit v1.2.3 (git 2.41.0)