Skip to content

Commit

Permalink
Final bit fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus committed Aug 22, 2023
1 parent f9fe9b9 commit 8fea115
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions qfieldsync/tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import shutil
import tempfile
from pathlib import Path
from typing import List

from qgis.core import Qgis, QgsOfflineEditing, QgsProject
from qgis.testing import start_app, unittest
Expand All @@ -46,6 +47,9 @@ def tearDown(self):
shutil.rmtree(self.source_dir)
shutil.rmtree(self.target_dir)

def _path_contents(self, dir_path: Path) -> List[str]:
return list(map(lambda p: str(p.relative_to(dir_path)), dir_path.iterdir()))

@property
def data_dir(self) -> Path:
return Path(__file__).parent.joinpath("data")
Expand Down Expand Up @@ -76,19 +80,21 @@ def test_copy(self):
)
offline_converter.convert()

files = list(self.target_dir.iterdir())
files = self._path_contents(self.target_dir)

self.assertIn("project_qfield.qgs", files)
self.assertIn("france_parts_shape.shp", files)
self.assertIn("france_parts_shape.dbf", files)
self.assertIn("curved_polys.gpkg", files)
self.assertIn("spatialite.db", files)

dcim_files = list(self.target_dir.joinpath("DCIM").iterdir())
dcim_files = self._path_contents(self.target_dir.joinpath("DCIM"))
self.assertIn("qfield-photo_1.jpg", dcim_files)
self.assertIn("qfield-photo_2.jpg", dcim_files)
self.assertIn("qfield-photo_3.jpg", dcim_files)
dcim_subfiles = list(self.target_dir.joinpath("DCIM", "subfolder").iterdir())
dcim_subfiles = self._path_contents(
self.target_dir.joinpath("DCIM", "subfolder")
)
self.assertIn("qfield-photo_sub_1.jpg", dcim_subfiles)
self.assertIn("qfield-photo_sub_2.jpg", dcim_subfiles)
self.assertIn("qfield-photo_sub_3.jpg", dcim_subfiles)
Expand Down

0 comments on commit 8fea115

Please sign in to comment.