From 24c686f6b274e04082b13f159ea10d995c2ca281 Mon Sep 17 00:00:00 2001 From: halcy Date: Sun, 13 Nov 2022 22:32:04 +0200 Subject: Improve auth support --- tests/test_auth.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'tests/test_auth.py') 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,14 +22,37 @@ def test_log_in_none(api_anonymous): with pytest.raises(MastodonIllegalArgumentError): api_anonymous.log_in() - @pytest.mark.vcr() def test_log_in_password(api_anonymous): token = api_anonymous.log_in( username='mastodonpy_test_2@localhost:3000', - password='5fc638e0e53eafd9c4145b6bb852667d') + password='5fc638e0e53eafd9c4145b6bb852667d' + ) assert token +@pytest.mark.vcr() +def test_revoke(api_anonymous): + token = api_anonymous.log_in( + username='mastodonpy_test_2@localhost:3000', + password='5fc638e0e53eafd9c4145b6bb852667d' + ) + api_anonymous.revoke_access_token() + + try: + api_anonymous.toot("illegal access detected") + assert False + except Exception as e: + print(e) + pass + + api_revoked_token = Mastodon(access_token = token) + try: + api_anonymous.toot("illegal access detected") + assert False + except Exception as e: + print(e) + pass + @pytest.mark.vcr() def test_log_in_password_incorrect(api_anonymous): with pytest.raises(MastodonIllegalArgumentError): -- cgit v1.2.3