diff options
Diffstat (limited to 'tests/test_auth.py')
-rw-r--r-- | tests/test_auth.py | 27 |
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() |
27 | def test_log_in_password(api_anonymous): | 26 | def 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() |
34 | def 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() | ||
34 | def test_log_in_password_incorrect(api_anonymous): | 57 | def 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( |