From 853cd82ecb9e1d25f395514b3bb1616071d43493 Mon Sep 17 00:00:00 2001 From: halcy Date: Sat, 19 Nov 2022 02:34:01 +0200 Subject: add ability to get detailed signup error from create_account --- tests/test_create_app.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'tests/test_create_app.py') diff --git a/tests/test_create_app.py b/tests/test_create_app.py index 8a7ea62..c7282df 100644 --- a/tests/test_create_app.py +++ b/tests/test_create_app.py @@ -70,5 +70,24 @@ def test_app_account_create(): # We can also test resending (marginally) test_app_api.email_resend_confirmation() - - +@pytest.mark.vcr(match_on=['path']) +def test_app_account_create_invalid(): + suffix = str(time.time()).replace(".", "")[-5:] + + test_app = test_app = Mastodon.create_app( + "mastodon.py generated test app", + api_base_url="http://localhost:3000/" + ) + + test_app_api = Mastodon( + test_app[0], + test_app[1], + api_base_url="http://localhost:3000/" + ) + test_token, error = test_app_api.create_account("coolguy" + suffix, "", "email@localhost" + suffix, agreement=False, return_detailed_error=True) + assert test_token is None + assert "details" in error + assert "password" in error.details + assert "password" in error.details + assert not "username" in error.details + \ No newline at end of file -- cgit v1.2.3