Revize 7d439051
Přidáno uživatelem David Friesecký před asi 4 roky(ů)
tests/dao/certificate_repository/conftest.py | ||
---|---|---|
1 |
import pytest |
|
2 |
import sqlite3 |
|
3 |
from sqlite3 import Connection, Cursor |
|
4 |
|
|
5 |
from src.dao.certificate_repository import CertificateRepository |
|
6 |
from src.constants import DATABASE_FILE |
|
7 |
|
|
8 |
|
|
9 |
@pytest.fixture |
|
10 |
def repository(): |
|
11 |
connection: Connection = sqlite3.connect("../../../" + DATABASE_FILE) |
|
12 |
cursor: Cursor = connection.cursor() |
|
13 |
return CertificateRepository(connection, cursor) |
tests/dao/certificate_repository/create_certificate.py | ||
---|---|---|
1 |
import pytest |
|
2 |
from src.constants import * |
|
3 |
|
|
4 |
|
|
5 |
def test_connection(repository): |
|
6 |
sql = f"SELECT * FROM {TAB_CERTIFICATE_TYPES}" |
|
7 |
repository.cursor.execute(sql) |
|
8 |
selected_rows = repository.cursor.fetchall() |
|
9 |
|
|
10 |
assert len(selected_rows) > 1 |
|
11 |
assert selected_rows[ROOT_CA_ID - 1][1] == "ROOT_CA" |
|
12 |
assert selected_rows[INTERMEDIATE_CA_ID - 1][1] == "INTERMEDIATE_CA" |
|
13 |
assert selected_rows[CERTIFICATE_ID - 1][1] == "CERTIFICATE" |
Také k dispozici: Unified diff
Re #8471 - Added initialize test