aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_search.yaml98
-rw-r--r--tests/test_search.py11
2 files changed, 101 insertions, 8 deletions
diff --git a/tests/cassettes/test_search.yaml b/tests/cassettes/test_search.yaml
index b4ecccc..1983178 100644
--- a/tests/cassettes/test_search.yaml
+++ b/tests/cassettes/test_search.yaml
@@ -8,15 +8,13 @@ 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/v1/search?resolve=0&q=mastodonpy_test 11 uri: http://localhost:3000/api/v1/search?q=mastodonpy_test
12 response: 12 response:
13 body: {string: '{"hashtags":[],"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John 13 body: {string: '{"hashtags":[],"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","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":0,"emojis":[],"fields":[]}],"statuses":[]}'}
14 Lennon","locked":true,"bot":false,"created_at":"2019-04-27T20:03:12.393Z","note":"\u003cp\u003eI
15 walk funny\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpeg?1556389071","avatar_static":"http://localhost/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpeg?1556389071","header":"http://localhost/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpeg?1556389071","header_static":"http://localhost/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpeg?1556389071","followers_count":0,"following_count":0,"statuses_count":61,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]}],"statuses":[]}'}
16 headers: 14 headers:
17 Cache-Control: ['max-age=0, private, must-revalidate'] 15 Cache-Control: ['max-age=0, private, must-revalidate']
18 Content-Type: [application/json; charset=utf-8] 16 Content-Type: [application/json; charset=utf-8]
19 ETag: [W/"e9c64c1dd043adc13b1f271dc991b218"] 17 ETag: [W/"9b6c418bdbb3a0abd5277c65cc102118"]
20 Referrer-Policy: [strict-origin-when-cross-origin] 18 Referrer-Policy: [strict-origin-when-cross-origin]
21 Transfer-Encoding: [chunked] 19 Transfer-Encoding: [chunked]
22 Vary: ['Accept-Encoding, Origin'] 20 Vary: ['Accept-Encoding, Origin']
@@ -24,9 +22,93 @@ interactions:
24 X-Download-Options: [noopen] 22 X-Download-Options: [noopen]
25 X-Frame-Options: [SAMEORIGIN] 23 X-Frame-Options: [SAMEORIGIN]
26 X-Permitted-Cross-Domain-Policies: [none] 24 X-Permitted-Cross-Domain-Policies: [none]
27 X-Request-Id: [4173731a-1280-4915-8023-adc11ffbcbb8] 25 X-Request-Id: [0d222257-5114-433c-b10b-1e7c849a6b9a]
28 X-Runtime: ['0.105438'] 26 X-Runtime: ['0.025732']
29 X-XSS-Protection: [1; mode=block] 27 X-XSS-Protection: [1; mode=block]
30 content-length: ['973'] 28 content-length: ['610']
29 status: {code: 200, message: OK}
30- request:
31 body: null
32 headers:
33 Accept: ['*/*']
34 Accept-Encoding: ['gzip, deflate']
35 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
36 Connection: [keep-alive]
37 User-Agent: [python-requests/2.18.4]
38 method: GET
39 uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test
40 response:
41 body: {string: '{"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","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":0,"emojis":[],"fields":[]}],"statuses":[],"hashtags":[]}'}
42 headers:
43 Cache-Control: ['max-age=0, private, must-revalidate']
44 Content-Type: [application/json; charset=utf-8]
45 ETag: [W/"dc01e7fe955c38320762927b42201386"]
46 Referrer-Policy: [strict-origin-when-cross-origin]
47 Transfer-Encoding: [chunked]
48 Vary: ['Accept-Encoding, Origin']
49 X-Content-Type-Options: [nosniff]
50 X-Download-Options: [noopen]
51 X-Frame-Options: [SAMEORIGIN]
52 X-Permitted-Cross-Domain-Policies: [none]
53 X-Request-Id: [fe4a8ac5-89c8-40fa-b156-b53907927af8]
54 X-Runtime: ['0.036339']
55 X-XSS-Protection: [1; mode=block]
56 content-length: ['610']
57 status: {code: 200, message: OK}
58- request:
59 body: null
60 headers:
61 Accept: ['*/*']
62 Accept-Encoding: ['gzip, deflate']
63 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
64 Connection: [keep-alive]
65 User-Agent: [python-requests/2.18.4]
66 method: GET
67 uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test
68 response:
69 body: {string: '{"accounts":[{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","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":0,"emojis":[],"fields":[]}],"statuses":[],"hashtags":[]}'}
70 headers:
71 Cache-Control: ['max-age=0, private, must-revalidate']
72 Content-Type: [application/json; charset=utf-8]
73 ETag: [W/"dc01e7fe955c38320762927b42201386"]
74 Referrer-Policy: [strict-origin-when-cross-origin]
75 Transfer-Encoding: [chunked]
76 Vary: ['Accept-Encoding, Origin']
77 X-Content-Type-Options: [nosniff]
78 X-Download-Options: [noopen]
79 X-Frame-Options: [SAMEORIGIN]
80 X-Permitted-Cross-Domain-Policies: [none]
81 X-Request-Id: [db56fc6d-bc14-4197-ad8e-526451c31ef8]
82 X-Runtime: ['0.031569']
83 X-XSS-Protection: [1; mode=block]
84 content-length: ['610']
85 status: {code: 200, message: OK}
86- request:
87 body: null
88 headers:
89 Accept: ['*/*']
90 Accept-Encoding: ['gzip, deflate']
91 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
92 Connection: [keep-alive]
93 User-Agent: [python-requests/2.18.4]
94 method: GET
95 uri: http://localhost:3000/api/v2/search?resolve=1&q=mastodonpy_test&type=statuses
96 response:
97 body: {string: '{"accounts":[],"statuses":[],"hashtags":[]}'}
98 headers:
99 Cache-Control: ['max-age=0, private, must-revalidate']
100 Content-Type: [application/json; charset=utf-8]
101 ETag: [W/"2f5f5aeb866795515ef92460da252331"]
102 Referrer-Policy: [strict-origin-when-cross-origin]
103 Transfer-Encoding: [chunked]
104 Vary: ['Accept-Encoding, Origin']
105 X-Content-Type-Options: [nosniff]
106 X-Download-Options: [noopen]
107 X-Frame-Options: [SAMEORIGIN]
108 X-Permitted-Cross-Domain-Policies: [none]
109 X-Request-Id: [0af31e14-f026-43f7-9fdc-b8e3130479cf]
110 X-Runtime: ['0.043284']
111 X-XSS-Protection: [1; mode=block]
112 content-length: ['43']
31 status: {code: 200, message: OK} 113 status: {code: 200, message: OK}
32version: 1 114version: 1
diff --git a/tests/test_search.py b/tests/test_search.py
index 7a39581..f05a023 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -2,5 +2,16 @@ import pytest
2 2
3@pytest.mark.vcr() 3@pytest.mark.vcr()
4def test_search(api): 4def test_search(api):
5 results = api.search_v1('mastodonpy_test')
6 assert isinstance(results, dict)
7
8 results = api.search_v2('mastodonpy_test')
9 assert isinstance(results, dict)
10
5 results = api.search('mastodonpy_test') 11 results = api.search('mastodonpy_test')
6 assert isinstance(results, dict) 12 assert isinstance(results, dict)
13
14 results = api.search('mastodonpy_test', result_type="statuses")
15 assert isinstance(results, dict)
16 assert len(results["hashtags"]) == 0
17 assert len(results["accounts"]) == 0
Powered by cgit v1.2.3 (git 2.41.0)