Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 3195e946

Přidáno uživatelem Jan Pašek před více než 3 roky(ů)

Re #8569 Fixed broken tests after injection implementation

Zobrazit rozdíly:

tests/integration_tests/dao/certificate_repository/conftest.py
9 9
@pytest.fixture
10 10
def repository():
11 11
    connection: Connection = sqlite3.connect(DATABASE_FILE)
12
    cursor: Cursor = connection.cursor()
13
    return CertificateRepository(connection, cursor)
12
    return CertificateRepository(connection)
tests/integration_tests/rest_api/certificates_test.py
434 434
    assert ret.json["data"] == "No such certificate found."
435 435

  
436 436

  
437
def test_get_detes(server):
437
def test_get_details(server):
438 438
    original = {
439 439
        "CA": 1,
440 440
        "subject": {
tests/integration_tests/rest_api/conftest.py
1 1
import pytest
2
import app
2 3
from app import app as flask_app
4
from src.config import configuration
5
from src.config.connection_provider import ConnectionProvider
6
from src.controllers.certificates_controller import CertController
3 7
from src.db.setup_database import setup_database
8
from injector import Module, Annotated, inject, Injector
4 9

  
5 10

  
6 11
@pytest.fixture(scope="session")
7 12
def server():
13
    injector = Injector([configuration.configure_default, ConnectionProvider])
14
    app.certificate_controller = injector.get(CertController)
15

  
8 16
    setup_database()
9 17
    flask_app.testing = True
10 18
    with flask_app.test_client() as s:
tests/integration_tests/services/conftest.py
47 47
# scope defaults to "function" which means that the fixture is run once per test (function)
48 48
@pytest.fixture
49 49
def certificate_repository(connection, cursor):
50
    return CertificateRepository(connection, cursor)
50
    return CertificateRepository(connection)
51 51

  
52 52

  
53 53
@pytest.fixture
54 54
def private_key_repository(connection, cursor):
55
    return PrivateKeyRepository(connection, cursor)
55
    return PrivateKeyRepository(connection)
56 56

  
57 57

  
58 58
@pytest.fixture
......
105 105
# scope defaults to "function" which means that the fixture is run once per test (function)
106 106
@pytest.fixture
107 107
def certificate_repository_unique(connection_unique, cursor_unique):
108
    return CertificateRepository(connection_unique, cursor_unique)
108
    return CertificateRepository(connection_unique)
109 109

  
110 110

  
111 111
@pytest.fixture
112 112
def private_key_repository_unique(connection_unique, cursor_unique):
113
    return PrivateKeyRepository(connection_unique, cursor_unique)
113
    return PrivateKeyRepository(connection_unique)
114 114

  
115 115

  
116 116
@pytest.fixture

Také k dispozici: Unified diff