-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ea6bb5
commit a2665e7
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import os | ||
from django.test import TestCase | ||
from mock import patch | ||
from importer import project_dir | ||
from importer.orchestrator import orchestrator | ||
from importer.datastore import DataStoreManager | ||
from importer.publisher import DataPublisher | ||
from unittest.mock import MagicMock | ||
from django.contrib.auth import get_user_model | ||
|
||
class TestDataStoreManager(TestCase): | ||
""" | ||
""" | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.files = {"base_file": f"{project_dir}/tests/fixture/valid.gpkg"} | ||
|
||
def setUp(self): | ||
self.user = get_user_model().objects.first() | ||
execution_id = orchestrator.create_execution_request( | ||
user=self.user, | ||
func_name="create", | ||
step="create", | ||
action="import", | ||
input_params={ | ||
**{"handler_module_path": "importer.handlers.gpkg.handler.GPKGFileHandler"}, | ||
}, | ||
source="importer_copy", | ||
) | ||
self.datastore = DataStoreManager( | ||
self.files, "importer.handlers.gpkg.handler.GPKGFileHandler", self.user, execution_id | ||
) | ||
|
||
execution_id_url = orchestrator.create_execution_request( | ||
user=self.user, | ||
func_name="create", | ||
step="create", | ||
action="import", | ||
input_params={ | ||
"url": "https://geosolutionsgroup.com" | ||
}, | ||
source="importer_copy", | ||
) | ||
self.datastore_url = DataStoreManager( | ||
self.files, "importer.handlers.common.remote.BaseRemoteResourceHandler", self.user, execution_id_url | ||
) | ||
self.gpkg_path = f"{project_dir}/tests/fixture/valid.gpkg" | ||
|
||
def test_input_is_valid_with_files(self): | ||
self.assertTrue(self.datastore.input_is_valid()) | ||
|
||
def test_input_is_valid_with_urls(self): | ||
self.assertTrue(self.datastore_url.input_is_valid()) |