Skip to content

Commit

Permalink
finish up test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Dec 25, 2024
1 parent aa918de commit 2ece958
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_ota_metadata/test_legacy/test_csv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from __future__ import annotations

import logging
import sqlite3
import stat
from pathlib import Path
Expand Down Expand Up @@ -45,6 +46,8 @@
from ota_metadata.legacy.rs_table import ResourceTable, ResourceTableORM
from tests.conftest import TestConfiguration as test_cfg

logger = logging.getLogger(__name__)

OTA_IMAGE_ROOT = Path(test_cfg.OTA_IMAGE_DIR)

#
Expand Down Expand Up @@ -212,18 +215,26 @@ def test_parse_and_import_regulars_txt():

rs_table_orm = ResourceTableORM(rs_table_conn)
rs_table_orm.orm_create_table()
parse_regulars_from_csv_file(regulars_txt, ft_table_orm, rs_table_orm)
_imported = parse_regulars_from_csv_file(
regulars_txt, ft_table_orm, rs_table_orm, cleanup=False
)
logger.info(f"imported {_imported} entries")
assert _imported > 0


def test_parse_and_import_dirs_txt():
with sqlite3.connect(":memory:") as conn:
orm = FileTableDirORM(conn)
orm.orm_create_table()
parse_dirs_from_csv_file(dirs_txt, orm)
_imported = parse_dirs_from_csv_file(dirs_txt, orm, cleanup=False)
logger.info(f"imported {_imported} entries")
assert _imported > 0


def test_parse_and_import_symlinks_txt():
with sqlite3.connect(":memory:") as conn:
orm = FileTableNonRegularORM(conn)
orm.orm_create_table()
parse_symlinks_from_csv_file(symlinks_txt, orm)
_imported = parse_symlinks_from_csv_file(symlinks_txt, orm, cleanup=False)
logger.info(f"imported {_imported} entries")
assert _imported > 0

0 comments on commit 2ece958

Please sign in to comment.