aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-27 14:35:56 +0100
committercodl <[email protected]>2017-11-27 14:35:56 +0100
commitadc75c469774ebbe0bece90a5abed07f6562dfaf (patch)
tree128d192b1448d83cf2056ae57c777e56f8883171 /tests
parent304145f4420180b23e0836a6d11fc0cec0e341bd (diff)
downloadmastodon.py-adc75c469774ebbe0bece90a5abed07f6562dfaf.tar.gz
add a test for accessing a tl that one does not have access to
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_home_tl_anonymous_throws.yaml28
-rw-r--r--tests/test_timeline.py6
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/cassettes/test_home_tl_anonymous_throws.yaml b/tests/cassettes/test_home_tl_anonymous_throws.yaml
new file mode 100644
index 0000000..ebf87e3
--- /dev/null
+++ b/tests/cassettes/test_home_tl_anonymous_throws.yaml
@@ -0,0 +1,28 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Connection: [keep-alive]
8 User-Agent: [python-requests/2.18.4]
9 method: GET
10 uri: http://localhost:3000/api/v1/timelines/home
11 response:
12 body: {string: '{"error":"The access token is invalid"}'}
13 headers:
14 Cache-Control: [no-store]
15 Content-Type: [application/json; charset=utf-8]
16 Pragma: [no-cache]
17 Transfer-Encoding: [chunked]
18 Vary: ['Accept-Encoding, Origin']
19 WWW-Authenticate: ['Bearer realm="Doorkeeper", error="invalid_token", error_description="The
20 access token is invalid"']
21 X-Content-Type-Options: [nosniff]
22 X-Frame-Options: [SAMEORIGIN]
23 X-Request-Id: [aa44c94d-0659-45a2-986d-a3c268195dfb]
24 X-Runtime: ['0.037813']
25 X-XSS-Protection: [1; mode=block]
26 content-length: ['39']
27 status: {code: 401, message: Unauthorized}
28version: 1
diff --git a/tests/test_timeline.py b/tests/test_timeline.py
index 492d0c7..eae0e80 100644
--- a/tests/test_timeline.py
+++ b/tests/test_timeline.py
@@ -28,3 +28,9 @@ def test_hashtag_tl(api):
28 assert status['id'] in map(lambda st: st['id'], tl) 28 assert status['id'] in map(lambda st: st['id'], tl)
29 finally: 29 finally:
30 api.status_delete(status['id']) 30 api.status_delete(status['id'])
31
32@pytest.mark.vcr()
33def test_home_tl_anonymous_throws(api_anonymous):
34 from mastodon.Mastodon import MastodonAPIError
35 with pytest.raises(MastodonAPIError):
36 tl = api_anonymous.timeline_home()
Powered by cgit v1.2.3 (git 2.41.0)