1
|
import pytest
|
2
|
import sqlite3
|
3
|
from sqlite3 import Connection, Cursor
|
4
|
|
5
|
from src.config.configuration import test_configuration
|
6
|
from src.config.connection_provider import ConnectionProvider
|
7
|
from src.dao.certificate_repository import CertificateRepository
|
8
|
from src.dao.private_key_repository import PrivateKeyRepository
|
9
|
from src.db.init_queries import SCHEMA_SQL, DEFAULT_VALUES_SQL
|
10
|
|
11
|
|
12
|
# scope="module" means that this fixture is run once per module
|
13
|
@pytest.fixture(scope="module")
|
14
|
def connection():
|
15
|
return ConnectionProvider().connect(test_configuration())
|
16
|
|
17
|
|
18
|
@pytest.fixture(scope="module")
|
19
|
def cursor(connection):
|
20
|
return connection.cursor()
|
21
|
|
22
|
|
23
|
@pytest.fixture
|
24
|
def connection_unique():
|
25
|
return ConnectionProvider().connect(test_configuration())
|
26
|
|
27
|
|
28
|
@pytest.fixture
|
29
|
def cursor_unique(connection):
|
30
|
return connection.cursor()
|
31
|
|
32
|
|
33
|
@pytest.fixture
|
34
|
def certificate_repository(connection):
|
35
|
return CertificateRepository(connection)
|
36
|
|
37
|
|
38
|
@pytest.fixture
|
39
|
def private_key_repository_unique(connection_unique, cursor_unique):
|
40
|
return PrivateKeyRepository(connection_unique)
|