aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-13 22:32:04 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-13 22:32:04 +0200
commit24c686f6b274e04082b13f159ea10d995c2ca281 (patch)
tree57b0095298f0564f6a5730a9b6a3ac9cdacb85b9 /tests/test_auth.py
parent5b328d479c17e44a6dde96408d6c8680b6c11ee0 (diff)
downloadmastodon.py-24c686f6b274e04082b13f159ea10d995c2ca281.tar.gz
Improve auth support
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)