Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6654bf8b

Přidáno uživatelem David Friesecký před asi 4 roky(ů)

Re #8578 - Edited conftest
- tests from private_key_repository_test use unique database

Zobrazit rozdíly:

tests/integration_tests/dao/conftest.py
17 17
    yield connection
18 18

  
19 19

  
20
@pytest.fixture
20
@pytest.fixture(scope="module")
21 21
def cursor(connection):
22 22
    cursor = connection.cursor()
23 23

  
......
29 29

  
30 30
    return cursor
31 31

  
32
@pytest.fixture
33
def connection_unique():
34
    print("Creating a new SQLITE connection to the test DB")
35
    connection: Connection = sqlite3.connect(':memory:')
36

  
37
    # yield the created connection
38
    yield connection
39

  
40

  
41
@pytest.fixture
42
def cursor_unique(connection):
43
    cursor = connection.cursor()
44

  
45
    # execute db initialisation script
46
    cursor.executescript(SCHEMA_SQL)
47

  
48
    # insert default values
49
    cursor.executescript(DEFAULT_VALUES_SQL)
50

  
51
    return cursor
52

  
32 53
@pytest.fixture
33 54
def certificate_repository(connection, cursor):
34 55
    return CertificateRepository(connection, cursor)
35 56

  
36 57
@pytest.fixture
37
def private_key_repository(connection, cursor):
38
    return PrivateKeyRepository(connection, cursor)
58
def private_key_repository(connection_unique, cursor_unique):
59
    return PrivateKeyRepository(connection_unique, cursor_unique)

Také k dispozici: Unified diff