source/projects/tentacles/test/python/conftest.py

46 lines
802 B
Python
Raw Normal View History

2023-05-13 22:58:17 +00:00
#!/usr/bin/env python3
from datetime import timedelta
import tentacles.store as s
import pytest
@pytest.yield_fixture
def store():
conn = s.Store(":memory:")
conn.connect()
yield conn
conn.close()
@pytest.fixture
def username_testy():
return "testy@test.com"
@pytest.fixture
def password_testy():
return "testpw"
@pytest.fixture
def uid_testy(store, username_testy, password_testy):
2023-05-23 04:21:53 +00:00
uid, status = store.try_create_user(
username_testy,
username_testy,
password_testy,
status_id=1,
)
return uid
2023-05-13 22:58:17 +00:00
@pytest.fixture
def login_ttl():
return timedelta(hours=12)
@pytest.fixture
def sid_testy(store, uid_testy, username_testy, password_testy, login_ttl):
return store.try_login(username_testy, password_testy, login_ttl)