Update datetime handling in ApiKey and Variable models (#1673)
* Update datetime handling in ApiKey and Variable models * Refactor test_login_successful function in test_login.py * Fix nullable attribute for created_at and updated_at fields in Variable model
This commit is contained in:
parent
4ee9b72634
commit
836ac08d80
6 changed files with 24 additions and 18 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import pytest
|
||||
from langflow.services.auth.utils import get_password_hash
|
||||
from langflow.services.database.models.user import User
|
||||
from langflow.services.database.utils import session_getter
|
||||
from langflow.services.deps import get_db_service
|
||||
from langflow.services.deps import session_scope
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
@ -17,9 +17,12 @@ def test_user():
|
|||
|
||||
def test_login_successful(client, test_user):
|
||||
# Adding the test user to the database
|
||||
with session_getter(get_db_service()) as session:
|
||||
session.add(test_user)
|
||||
session.commit()
|
||||
try:
|
||||
with session_scope() as session:
|
||||
session.add(test_user)
|
||||
session.commit()
|
||||
except IntegrityError:
|
||||
pass
|
||||
|
||||
response = client.post("api/v1/login", data={"username": "testuser", "password": "testpassword"})
|
||||
assert response.status_code == 200
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue