aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-10-12 22:05:35 +0200
committerLorenz Diener <[email protected]>2019-10-12 22:05:35 +0200
commit1f36deb11950a627b52a587fc3ec30c37f9bb456 (patch)
tree450aed6468f83de31492e90b0cefb42b2e07765a /tests
parent63bf5afc61503ebd99a7e7bc36014b378db98d23 (diff)
downloadmastodon.py-1f36deb11950a627b52a587fc3ec30c37f9bb456.tar.gz
Add, test and document profile directory API (fixes #188)
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_directory.yaml29
-rw-r--r--tests/setup.sql6
-rw-r--r--tests/test_instance.py9
3 files changed, 41 insertions, 3 deletions
diff --git a/tests/cassettes/test_directory.yaml b/tests/cassettes/test_directory.yaml
new file mode 100644
index 0000000..6c478e3
--- /dev/null
+++ b/tests/cassettes/test_directory.yaml
@@ -0,0 +1,29 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
8 Connection: [keep-alive]
9 User-Agent: [python-requests/2.18.4]
10 method: GET
11 uri: http://localhost:3000/api/v1/directory
12 response:
13 body: {string: '[{"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":[]}]'}
14 headers:
15 Cache-Control: ['no-cache, no-store']
16 Content-Type: [application/json; charset=utf-8]
17 Referrer-Policy: [strict-origin-when-cross-origin]
18 Transfer-Encoding: [chunked]
19 Vary: ['Accept-Encoding, Origin']
20 X-Content-Type-Options: [nosniff]
21 X-Download-Options: [noopen]
22 X-Frame-Options: [SAMEORIGIN]
23 X-Permitted-Cross-Domain-Policies: [none]
24 X-Request-Id: [fedf048d-8ed4-4185-bcb4-11384f0db697]
25 X-Runtime: ['0.141196']
26 X-XSS-Protection: [1; mode=block]
27 content-length: ['597']
28 status: {code: 200, message: OK}
29version: 1
diff --git a/tests/setup.sql b/tests/setup.sql
index 74b1d80..0230655 100644
--- a/tests/setup.sql
+++ b/tests/setup.sql
@@ -46,13 +46,15 @@ INSERT INTO accounts (
46 username, 46 username,
47 locked, 47 locked,
48 created_at, 48 created_at,
49 updated_at 49 updated_at,
50 discoverable
50) VALUES ( 51) VALUES (
51 1234567890123457, 52 1234567890123457,
52 'mastodonpy_test_2', 53 'mastodonpy_test_2',
53 't', 54 't',
54 now(), 55 now(),
55 now() 56 now(),
57 t
56); 58);
57 59
58INSERT INTO users ( 60INSERT INTO users (
diff --git a/tests/test_instance.py b/tests/test_instance.py
index e7dee1f..2762ecb 100644
--- a/tests/test_instance.py
+++ b/tests/test_instance.py
@@ -43,8 +43,15 @@ def test_nodeinfo(api):
43 assert nodeinfo 43 assert nodeinfo
44 assert nodeinfo.version == '2.0' 44 assert nodeinfo.version == '2.0'
45 45
46
47@pytest.mark.vcr() 46@pytest.mark.vcr()
48def test_trends(api): 47def test_trends(api):
49 assert isinstance(api.trends(), list) 48 assert isinstance(api.trends(), list)
50 49
50@pytest.mark.vcr()
51def test_directory(api):
52 directory = api.directory()
53 assert directory
54 assert isinstance(directory, list)
55 assert len(directory) > 0
56
57
Powered by cgit v1.2.3 (git 2.41.0)