Login now based on email
Build LinkLog Development Image / development-image (push) Successful in 10s
Build LinkLog Development Image / development-image (push) Successful in 10s
This commit is contained in:
@@ -12,7 +12,7 @@ client = TestClient(app)
|
||||
|
||||
def test_user_config_api_and_profile_page():
|
||||
login = client.post('/api/auth/login', json={
|
||||
'username': 'alice',
|
||||
'email': 'alice@example.com',
|
||||
'password': 'secret123',
|
||||
}).json()
|
||||
headers = {'Authorization': f"Bearer {login['access_token']}"}
|
||||
@@ -47,7 +47,7 @@ def test_user_config_api_and_profile_page():
|
||||
assert 'name="new_password_confirmation"' in page_response.text
|
||||
|
||||
bob_login = client.post('/api/auth/login', json={
|
||||
'username': 'bob',
|
||||
'email': 'bob@example.com',
|
||||
'password': 'secret123',
|
||||
}).json()
|
||||
bob_headers = {'Authorization': f"Bearer {bob_login['access_token']}"}
|
||||
@@ -57,7 +57,7 @@ def test_user_config_api_and_profile_page():
|
||||
}, headers=bob_headers)
|
||||
assert password_response.status_code == 200
|
||||
assert client.post('/api/auth/login', json={
|
||||
'username': 'bob',
|
||||
'email': 'bob@example.com',
|
||||
'password': 'new-secret-123',
|
||||
}).status_code == 200
|
||||
assert client.put('/api/user/password', json={
|
||||
@@ -80,7 +80,7 @@ def test_user_config_api_and_profile_page():
|
||||
|
||||
|
||||
def test_user_can_enable_and_use_otp():
|
||||
login = client.post('/api/auth/login', json={'username': 'alice', 'password': 'secret123'}).json()
|
||||
login = client.post('/api/auth/login', json={'email': 'alice@example.com', 'password': 'secret123'}).json()
|
||||
headers = {'Authorization': f"Bearer {login['access_token']}"}
|
||||
setup = client.post('/api/user/otp/setup', headers=headers)
|
||||
assert setup.status_code == 200
|
||||
@@ -92,10 +92,10 @@ def test_user_can_enable_and_use_otp():
|
||||
})
|
||||
assert enabled.status_code == 200
|
||||
assert enabled.json()['enabled'] is True
|
||||
assert client.post('/api/auth/login', json={'username': 'alice', 'password': 'secret123'}).status_code == 401
|
||||
assert client.post('/api/auth/login', json={'email': 'alice@example.com', 'password': 'secret123'}).status_code == 401
|
||||
|
||||
otp_login = client.post('/api/auth/login', json={
|
||||
'username': 'alice', 'password': 'secret123', 'otp': current_code(secret),
|
||||
'email': 'alice@example.com', 'password': 'secret123', 'otp': current_code(secret),
|
||||
})
|
||||
assert otp_login.status_code == 200
|
||||
|
||||
|
||||
Reference in New Issue
Block a user