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
|
|
10
|
|
11
|
# scope="module" means that this fixture is run once per module
|
12
|
@pytest.fixture(scope="module")
|
13
|
def connection():
|
14
|
return ConnectionProvider().connect(test_configuration())
|
15
|
|
16
|
|
17
|
@pytest.fixture(scope="module")
|
18
|
def cursor(connection):
|
19
|
return connection.cursor()
|
20
|
|
21
|
|
22
|
@pytest.fixture
|
23
|
def connection_unique():
|
24
|
return ConnectionProvider().connect(test_configuration())
|
25
|
|
26
|
|
27
|
@pytest.fixture
|
28
|
def cursor_unique(connection):
|
29
|
return connection.cursor()
|
30
|
|
31
|
|
32
|
@pytest.fixture
|
33
|
def certificate_repository(connection):
|
34
|
return CertificateRepository(connection)
|
35
|
|
36
|
|
37
|
@pytest.fixture
|
38
|
def private_key_repository_unique(connection_unique, cursor_unique):
|
39
|
return PrivateKeyRepository(connection_unique)
|