Пример #1
0
def test_sign_in_with_wrong_password(client):
    UserFactory.create_with_hashed_password(email='*****@*****.**',
                                            password='******')
    payload = {'email': '*****@*****.**', 'password': '******'}

    response = client.post('/api/sign-in', json=payload)

    assert response.status_code == 401
    assert response.json['errors'] == 'Invalid Credentials'
Пример #2
0
def test_sign_in_with_user_not_activated(client):
    UserFactory.create_with_hashed_password(email='*****@*****.**',
                                            password='******',
                                            is_active=False)
    payload = {'email': '*****@*****.**', 'password': '******'}

    response = client.post('/api/sign-in', json=payload)

    assert response.status_code == 401
    assert response.json['errors'] == 'Not activated'
Пример #3
0
def test_sign_in_ok(client):
    UserFactory.create_with_hashed_password(email='*****@*****.**',
                                            password='******')
    payload = {'email': '*****@*****.**', 'password': '******'}

    response = client.post('/api/sign-in', json=payload)

    response_data = response.json['data']
    assert response.status_code == 200
    assert response_data['access_token']
    assert response_data['refresh_token']
    assert response_data['expires_in']
    assert response_data['token_type']