示例#1
0
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_email = mock_cognito.confirm_sign_up.mock_calls[0][1]
    assert result_email == '*****@*****.**'
    assert result_code == '123456'
def test_confirm_register_fails(mock_cognito):
    """Test an error during confirmation of an account."""
    cloud = MagicMock()
    cloud.cognito_email_based = False
    mock_cognito.confirm_sign_up.side_effect = aws_error('SomeError')
    with pytest.raises(auth_api.CloudError):
        auth_api.confirm_register(cloud, '123456', '*****@*****.**')
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_email = mock_cognito.confirm_sign_up.mock_calls[0][1]
    assert result_email == '*****@*****.**'
    assert result_code == '123456'
示例#4
0
def test_confirm_register_fails(mock_cognito):
    """Test an error during confirmation of an account."""
    cloud = MagicMock()
    cloud.cognito_email_based = False
    mock_cognito.confirm_sign_up.side_effect = aws_error('SomeError')
    with pytest.raises(auth_api.CloudError):
        auth_api.confirm_register(cloud, '123456', '*****@*****.**')
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'
示例#6
0
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'