Beispiel #1
0
 def test_should_raise_an_exception_when_trying_to_register_an_account_incorrectly(
         self):
     """... it should raise an exception when trying to register an account incorrectly"""
     address, password, _ = create_new_account()
     with pytest.raises(CouldNotGetAccountException):
         # trying to register the same account twice will result in an error from the api
         MailTm._make_account_request("accounts", address, password)
Beispiel #2
0
def create_new_account() -> Tuple[str, str, Dict[str, str]]:
    """ use MailTm._make_account_request to create a new random account """
    mt = MailTm()
    domain = mt._get_domains_list()[0]
    username = generate_username(1)[0].lower()
    address = f"{username}@{domain}"
    password = mt._generate_password(6)
    response = mt._make_account_request("accounts", address, password)
    return address, password, response
Beispiel #3
0
 def test_should_allow_to_recover_the_token_for_an_existing_account(self):
     """... it should allow to recover the token for an existing account"""
     address, password, _ = create_new_account()
     jwt = MailTm._make_account_request("token", address, password)
     assert "token" in jwt
     assert "id" in jwt