Skip to content

Commit

Permalink
Add test coverage and refactor with black
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiagiupponi committed Jun 6, 2024
1 parent 6bb056a commit 2661110
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions importer/handlers/tiles3d/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,13 @@ def test_generate_resource_payload(self):
asset="asset",
link_type="uploaded",
extension="3dtiles",
alternate="alternate"
)

actual = self.handler.generate_resource_payload(
"Layer name", "alternate", "asset", _exec_obj, None
)
self.assertSetEqual(set(list(actual.keys())), set(list(expected.keys())))
self.assertDictEqual(actual, expected)

def test_create_geonode_resource_validate_bbox_with_region(self):
Expand Down
3 changes: 2 additions & 1 deletion importer/tests/end2end/test_end2end.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _assertimport(
self.client.force_login(self.admin)

response = self.client.post(self.url, data=payload)
self.assertEqual(201, response.status_code)
self.assertEqual(201, response.status_code, response.json())

# if is async, we must wait. It will wait for 1 min before raise exception
if ast.literal_eval(os.getenv("ASYNC_SIGNALS", "False")):
Expand Down Expand Up @@ -452,6 +452,7 @@ class Importer3DtilesImportTest(BaseImporterEndToEndTest):
GEODATABASE_URL=f"{geourl.split('/geonode_data')[0]}/test_geonode_data"
)
def test_import_3dtiles(self):
ResourceBase.objects.filter(alternate__icontains="valid_3dtiles").delete()
payload = {
"zip_file": open(self.valid_3dtiles, "rb"),
"base_file": open(self.valid_3dtiles, "rb"),
Expand Down
2 changes: 1 addition & 1 deletion runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -a
. ./.env_test
set +a

coverage run --source='.' --omit="*/test*" /usr/src/geonode/manage.py test importer -v2 --noinput
coverage run --source='.' --omit="*/test*" /usr/src/geonode/manage.py test importer -v2 --noinput

0 comments on commit 2661110

Please sign in to comment.