add a test for accessing a tl that one does not have access to
This commit is contained in:
pare
304145f442
commit
adc75c4697
S'han modificat 2 arxius amb 34 adicions i 0 eliminacions
28
tests/cassettes/test_home_tl_anonymous_throws.yaml
Normal file
28
tests/cassettes/test_home_tl_anonymous_throws.yaml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
interactions:
|
||||||
|
- request:
|
||||||
|
body: null
|
||||||
|
headers:
|
||||||
|
Accept: ['*/*']
|
||||||
|
Accept-Encoding: ['gzip, deflate']
|
||||||
|
Connection: [keep-alive]
|
||||||
|
User-Agent: [python-requests/2.18.4]
|
||||||
|
method: GET
|
||||||
|
uri: http://localhost:3000/api/v1/timelines/home
|
||||||
|
response:
|
||||||
|
body: {string: '{"error":"The access token is invalid"}'}
|
||||||
|
headers:
|
||||||
|
Cache-Control: [no-store]
|
||||||
|
Content-Type: [application/json; charset=utf-8]
|
||||||
|
Pragma: [no-cache]
|
||||||
|
Transfer-Encoding: [chunked]
|
||||||
|
Vary: ['Accept-Encoding, Origin']
|
||||||
|
WWW-Authenticate: ['Bearer realm="Doorkeeper", error="invalid_token", error_description="The
|
||||||
|
access token is invalid"']
|
||||||
|
X-Content-Type-Options: [nosniff]
|
||||||
|
X-Frame-Options: [SAMEORIGIN]
|
||||||
|
X-Request-Id: [aa44c94d-0659-45a2-986d-a3c268195dfb]
|
||||||
|
X-Runtime: ['0.037813']
|
||||||
|
X-XSS-Protection: [1; mode=block]
|
||||||
|
content-length: ['39']
|
||||||
|
status: {code: 401, message: Unauthorized}
|
||||||
|
version: 1
|
|
@ -28,3 +28,9 @@ def test_hashtag_tl(api):
|
||||||
assert status['id'] in map(lambda st: st['id'], tl)
|
assert status['id'] in map(lambda st: st['id'], tl)
|
||||||
finally:
|
finally:
|
||||||
api.status_delete(status['id'])
|
api.status_delete(status['id'])
|
||||||
|
|
||||||
|
@pytest.mark.vcr()
|
||||||
|
def test_home_tl_anonymous_throws(api_anonymous):
|
||||||
|
from mastodon.Mastodon import MastodonAPIError
|
||||||
|
with pytest.raises(MastodonAPIError):
|
||||||
|
tl = api_anonymous.timeline_home()
|
||||||
|
|
Loading…
Referencia en una nova incidència