diff options
author | Lorenz Diener <[email protected]> | 2019-04-28 17:56:20 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-04-28 17:56:20 +0200 |
commit | b6692f0b16820da8388a5445bcfbf464a4648c91 (patch) | |
tree | 1facbe6e5755f8c3894048cda3bbb0ce9466fa20 /tests/test_create_app.py | |
parent | a29d278bf9cacf5f888561564f112312707e32fd (diff) | |
download | mastodon.py-b6692f0b16820da8388a5445bcfbf464a4648c91.tar.gz |
Add account creation
Diffstat (limited to 'tests/test_create_app.py')
-rw-r--r-- | tests/test_create_app.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_create_app.py b/tests/test_create_app.py index 67318e9..f1153bc 100644 --- a/tests/test_create_app.py +++ b/tests/test_create_app.py | |||
@@ -1,6 +1,8 @@ | |||
1 | from mastodon import Mastodon | 1 | from mastodon import Mastodon |
2 | import pytest | 2 | import pytest |
3 | import requests | 3 | import requests |
4 | import time | ||
5 | |||
4 | try: | 6 | try: |
5 | from mock import Mock | 7 | from mock import Mock |
6 | except ImportError: | 8 | except ImportError: |
@@ -46,3 +48,22 @@ def test_app_verify_credentials(api): | |||
46 | app = api.app_verify_credentials() | 48 | app = api.app_verify_credentials() |
47 | assert app | 49 | assert app |
48 | assert app.name == 'Mastodon.py test suite' | 50 | assert app.name == 'Mastodon.py test suite' |
51 | |||
52 | @pytest.mark.vcr() | ||
53 | def test_app_account_create(): | ||
54 | # This leaves behind stuff on the test server, which is unfortunate, but eh. | ||
55 | suffix = str(time.time()).replace(".", "")[-5:] | ||
56 | |||
57 | test_app = test_app = Mastodon.create_app( | ||
58 | "mastodon.py generated test app", | ||
59 | api_base_url="http://localhost:3000/" | ||
60 | ) | ||
61 | |||
62 | test_app_api = Mastodon( | ||
63 | test_app[0], | ||
64 | test_app[1], | ||
65 | api_base_url="http://localhost:3000/" | ||
66 | ) | ||
67 | test_token = test_app_api.create_account("coolguy" + suffix, "swordfish", "email@localhost" + suffix, agreement=True) | ||
68 | assert test_token | ||
69 | |||