aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Piper <[email protected]>2022-11-13 22:04:13 +0000
committerAndy Piper <[email protected]>2022-11-13 22:04:13 +0000
commit3d10b13f3268e0d9988be2c8923397a76d9b1d43 (patch)
tree9d795e7a41021acc2c573e1f0d4947e84648c393 /tests/test_auth.py
parentcf25f694463bf0dc8745a5e61a08a2cb73d17919 (diff)
parent7b9f07fc0c89eb7c5b3b0924201035239cdc138a (diff)
downloadmastodon.py-3d10b13f3268e0d9988be2c8923397a76d9b1d43.tar.gz
Merge branch 'master' into doc-updates
Diffstat (limited to 'tests/test_auth.py')
-rw-r--r--tests/test_auth.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/test_auth.py b/tests/test_auth.py
index c3acb66..a14b4e7 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -22,15 +22,38 @@ def test_log_in_none(api_anonymous):
22 with pytest.raises(MastodonIllegalArgumentError): 22 with pytest.raises(MastodonIllegalArgumentError):
23 api_anonymous.log_in() 23 api_anonymous.log_in()
24 24
25
26@pytest.mark.vcr() 25@pytest.mark.vcr()
27def test_log_in_password(api_anonymous): 26def test_log_in_password(api_anonymous):
28 token = api_anonymous.log_in( 27 token = api_anonymous.log_in(
29 username='mastodonpy_test_2@localhost:3000', 28 username='mastodonpy_test_2@localhost:3000',
30 password='5fc638e0e53eafd9c4145b6bb852667d') 29 password='5fc638e0e53eafd9c4145b6bb852667d'
30 )
31 assert token 31 assert token
32 32
33@pytest.mark.vcr() 33@pytest.mark.vcr()
34def test_revoke(api_anonymous):
35 token = api_anonymous.log_in(
36 username='mastodonpy_test_2@localhost:3000',
37 password='5fc638e0e53eafd9c4145b6bb852667d'
38 )
39 api_anonymous.revoke_access_token()
40
41 try:
42 api_anonymous.toot("illegal access detected")
43 assert False
44 except Exception as e:
45 print(e)
46 pass
47
48 api_revoked_token = Mastodon(access_token = token)
49 try:
50 api_anonymous.toot("illegal access detected")
51 assert False
52 except Exception as e:
53 print(e)
54 pass
55
56@pytest.mark.vcr()
34def test_log_in_password_incorrect(api_anonymous): 57def test_log_in_password_incorrect(api_anonymous):
35 with pytest.raises(MastodonIllegalArgumentError): 58 with pytest.raises(MastodonIllegalArgumentError):
36 api_anonymous.log_in( 59 api_anonymous.log_in(
Powered by cgit v1.2.3 (git 2.41.0)