def test_confirm_register(mock_cognito): """Test confirming a registration of an account.""" auth_api.confirm_register(None, '123456', '*****@*****.**') assert len(mock_cognito.confirm_sign_up.mock_calls) == 1 result_code, result_user = mock_cognito.confirm_sign_up.mock_calls[0][1] assert result_user == \ auth_api._generate_username('*****@*****.**') assert result_code == '123456'
def test_register(mock_cognito): """Test registering an account.""" auth_api.register(None, '*****@*****.**', 'password') assert len(mock_cognito.register.mock_calls) == 1 result_user, result_password = mock_cognito.register.mock_calls[0][1] assert result_user == \ auth_api._generate_username('*****@*****.**') assert result_password == 'password'
def test_confirm_register(mock_cognito): """Test confirming a registration of an account.""" cloud = MagicMock() cloud.cognito_email_based = False auth_api.confirm_register(cloud, '123456', '*****@*****.**') assert len(mock_cognito.confirm_sign_up.mock_calls) == 1 result_code, result_user = mock_cognito.confirm_sign_up.mock_calls[0][1] assert result_user == \ auth_api._generate_username('*****@*****.**') assert result_code == '123456'
def test_confirm_register_view(mock_cognito, cloud_client): """Test logging out.""" req = yield from cloud_client.post('/api/cloud/confirm_register', json={ 'email': '*****@*****.**', 'confirmation_code': '123456' }) assert req.status == 200 assert len(mock_cognito.confirm_sign_up.mock_calls) == 1 result_code, result_email = mock_cognito.confirm_sign_up.mock_calls[0][1] assert result_email == auth_api._generate_username('*****@*****.**') assert result_code == '123456'
def test_register_view(mock_cognito, cloud_client): """Test logging out.""" req = yield from cloud_client.post('/api/cloud/register', json={ 'email': '*****@*****.**', 'password': '******' }) assert req.status == 200 assert len(mock_cognito.register.mock_calls) == 1 result_email, result_pass = mock_cognito.register.mock_calls[0][1] assert result_email == auth_api._generate_username('*****@*****.**') assert result_pass == 'falcon42'
def test_register(mock_cognito): """Test registering an account.""" cloud = MagicMock() cloud.cognito_email_based = False cloud = MagicMock() cloud.cognito_email_based = False auth_api.register(cloud, '*****@*****.**', 'password') assert len(mock_cognito.register.mock_calls) == 1 result_user, result_password = mock_cognito.register.mock_calls[0][1] assert result_user == \ auth_api._generate_username('*****@*****.**') assert result_password == 'password'