pymastodon/tests/test_authorization.py

25 lines
643 B
Python
Raw Normal View History

2024-04-30 08:42:20 +02:00
from mastodon.application import MastodonApplication
import pytest
import responses
2024-04-30 08:42:20 +02:00
@pytest.fixture
def app():
yield MastodonApplication("pymastodon")
@responses.activate
2024-04-30 08:42:20 +02:00
def test_authorize(app):
# responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
# json={'error': 'not found'}, status=404)
responses.post(
"http://social.example.com/oauth/token",
json={"type": "post"},
)
2024-04-30 08:42:20 +02:00
app.authorization.authorize()
token = app.authorization.fetch_token()
assert token is not None
def test_get_login_url(app):
url = app.authorization.get_login_url()
assert url is not None