Skip to content

Commit

Permalink
add tests to search for the existance or not of files and geometry, re
Browse files Browse the repository at this point in the history
  • Loading branch information
apeters committed Aug 14, 2024
1 parent 8f8ac4b commit 05db0d8
Show file tree
Hide file tree
Showing 9 changed files with 2,515 additions and 16 deletions.
24 changes: 17 additions & 7 deletions tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ def loadOntology(cls):
)

@classmethod
def ensure_resource_test_model_loaded(cls):
resource_test_model_graph_id = "c9b37a14-17b3-11eb-a708-acde48001122"
def ensure_test_resource_models_are_loaded(cls):
custom_string_datatype_filename = os.path.join(
test_settings.TEST_ROOT,
"fixtures",
Expand All @@ -135,12 +134,23 @@ def ensure_resource_test_model_loaded(cls):
source=custom_string_datatype_filename,
verbosity=0,
)
if not Graph.objects.filter(pk=resource_test_model_graph_id).exists():
for path in test_settings.RESOURCE_GRAPH_LOCATIONS:
# if not Graph.objects.filter(pk=resource_test_model_graph_id).exists():
for path in test_settings.RESOURCE_GRAPH_LOCATIONS:
file_paths = [
file_path
for file_path in os.listdir(path)
if file_path.endswith(".json")
]
for file_path in file_paths:
with captured_stdout():
management.call_command(
"packages", operation="import_graphs", source=path, verbosity=0
)
with open(os.path.join(path, file_path), "r") as f:
archesfile = JSONDeserializer().deserialize(f)
errs, importer = ResourceGraphImporter(
archesfile["graph"], overwrite_graphs=False
)
# management.call_command(
# "packages", operation="import_graphs", source=path, verbosity=0
# )

@classmethod
def setUpClass(cls):
Expand Down
2 changes: 1 addition & 1 deletion tests/bulkdata/bulk_data_delete_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def setUpClass(self):
LanguageSynchronizer.synchronize_settings_with_db()
self.bulk_deleter = BulkDataDeletion()
self.loadOntology()
self.ensure_resource_test_model_loaded()
self.ensure_test_resource_models_are_loaded()

def test_get_number_of_deletions_with_no_resourceids(self):
loadid = str(uuid.uuid4())
Expand Down
Loading

0 comments on commit 05db0d8

Please sign in to comment.