storage.test package¶
Subpackages¶
Submodules¶
storage.test.test_delete_files_job module¶
storage.test.test_geospatial_utils module¶
-
class
storage.test.test_geospatial_utils.TestGeospatialUtils(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_get_center_point()¶ Tests calculating center point
-
test_parse_bad_geo_json()¶ Tests parsing bad geojson
-
test_parse_geo_json()¶ Tests parsing geojson
-
test_valid_feature(*args, **keywargs)¶ Tests parsing geojson
-
test_valid_feature_collection(*args, **keywargs)¶ Tests parsing geojson
-
test_valid_feature_no_props(*args, **keywargs)¶ Tests parsing geojson
-
test_valid_polygon(*args, **keywargs)¶ Tests parsing geojson
-
storage.test.test_models module¶
-
class
storage.test.test_models.TestCountryData(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_access()¶
-
test_border_update()¶
-
test_border_update_not_found()¶
-
test_not_found()¶
-
-
class
storage.test.test_models.TestPurgeResults(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_access()¶
-
test_not_found()¶
-
-
class
storage.test.test_models.TestScaleFile(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_country_data()¶ Tests adding a border and country intersection calculation.
-
test_set_deleted()¶ Tests marking a file as deleted.
-
test_url()¶ Tests building a URL for a file.
-
test_url_base_slash()¶ Tests building a URL for a file where the workspace base URL has a trailing slash.
-
test_url_base_url_missing()¶ Tests building a URL for a file in a workspace with no configured base URL.
-
test_url_file_slash()¶ Tests building a URL for a file where the file path URL has a leading slash.
-
-
class
storage.test.test_models.TestScaleFileAddDataTypeTag(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_same_tag()¶ Tests calling add_data_type_tag() with the same tag twice
-
test_valid()¶ Tests calling add_data_type_tag() with valid tags
-
-
class
storage.test.test_models.TestScaleFileGetDataTypeTags(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
Tests calling get_data_type_tags() with no tags
Tests calling get_data_type_tags() with tags
-
-
class
storage.test.test_models.TestScaleFileManagerDeleteFiles(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_deleted_file()¶ Tests attempting to delete a file that is already deleted
-
test_inactive_workspace()¶ Tests calling deleting files from an inactive workspace
-
test_success()¶ Tests deleting files successfully
-
-
class
storage.test.test_models.TestScaleFileManagerDownloadFiles(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_deleted_file()¶ Tests calling ScaleFileManager.download_files() with a deleted file
-
test_inactive_workspace()¶ Tests calling ScaleFileManager.download_files() with an inactive workspace
-
test_success()¶ Tests calling ScaleFileManager.download_files() successfully
-
-
class
storage.test.test_models.TestScaleFileManagerMoveFiles(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_deleted_file()¶ Tests calling ScaleFileManager.move_files() with a deleted file
-
test_inactive_workspace()¶ Tests calling ScaleFileManager.move_files() with an inactive workspace
-
test_success()¶ Tests calling ScaleFileManager.move_files() successfully
-
-
class
storage.test.test_models.TestScaleFileManagerUploadFiles(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_fails(*args, **keywargs)¶ Tests calling ScaleFileManager.upload_files() when Workspace.upload_files() fails
-
test_success(*args, **keywargs)¶ Tests calling ScaleFileManager.upload_files() successfully
-
-
class
storage.test.test_models.TestScaleFileUpdateUUID(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_multi_strings()¶ Tests calling update_uuid with multiple strings.
-
test_none()¶ Tests calling update_uuid with no arguments.
-
test_objects()¶ Tests calling update_uuid with multiple object types.
-
test_one_string()¶ Tests calling update_uuid with a single string.
-
test_partial()¶ Tests calling update_uuid with some ignored None types.
-
-
class
storage.test.test_models.TestWorkspaceManager(methodName='runTest')¶ Bases:
django.test.testcases.TransactionTestCase-
setUp()¶
-
test_broker_validation()¶ Tests that getting the broker instance performs validation.
-
test_broker_validation_error()¶ Tests that attempting to get a bad broker instance raises an error.
-
test_successful()¶ Tests calling WorkspaceManager.create_workspace() successfully
-
storage.test.test_move_files_job module¶
-
class
storage.test.test_move_files_job.TestMoveFiles(methodName='runTest')¶ Bases:
django.test.testcases.TestCase-
setUp()¶
-
test_move_file_new_path(*args, **keywargs)¶ Tests moving a file
-
test_move_file_new_workspace(*args, **keywargs)¶ Tests moving a file
-
test_move_file_new_workspace_without_download(*args, **keywargs)¶ Tests moving a file
-
storage.test.test_views module¶
-
class
storage.test.test_views.TestFileDetailsViewV6(methodName='runTest')¶ Bases:
rest_framework.test.APITestCase-
api= u'v6'¶
-
setUp()¶
-
test_id()¶ Tests successfully calling the files detail view by id
-
test_missing()¶ Tests calling the file details view with an invalid id
-
-
class
storage.test.test_views.TestFilesViewV6(methodName='runTest')¶ Bases:
rest_framework.test.APITestCase-
api= u'v6'¶
-
setUp()¶
-
test_country_filter_successful()¶ Tests successfully calling the get files by source time
-
test_created_time_successful()¶ Tests successfully calling the get files by created time
-
test_file_name()¶ Tests successfully calling the files view filtered by file name.
-
test_invalid_ended()¶ Tests calling the files view when the ended parameter is invalid.
-
test_invalid_started()¶ Tests calling the files view when the started parameter is invalid.
-
test_job_output()¶ Tests successfully calling the files view filtered by job output.
-
test_job_type_id()¶ Tests successfully calling the files view filtered by job type identifier.
-
test_job_type_name()¶ Tests successfully calling the files view filtered by job type name.
-
test_missing_tz_ended()¶ Tests calling the files view when the ended parameter is missing timezone.
-
test_missing_tz_started()¶ Tests calling the files view when the started parameter is missing timezone.
-
test_negative_time_range()¶ Tests calling the files view with a negative time range.
-
test_recipe_node()¶ Tests successfully calling the files view filtered by recipe job.
-
test_source_collection()¶ Tests successfully calling the files view filtered by source collection.
-
test_source_sensor()¶ Tests successfully calling the files view filtered by source sensor.
-
test_source_sensor_class()¶ Tests successfully calling the files view filtered by source sensor class.
-
test_source_task()¶ Tests successfully calling the files view filtered by source task.
-
test_source_time_successful()¶ Tests successfully calling the get files by source time
-
test_successful()¶ Tests successfully calling the files view.
-
-
class
storage.test.test_views.TestPurgeSourceFileView(methodName='runTest')¶ Bases:
rest_framework.test.APITestCaseTests related to the purge source endpoint
-
api= u'v6'¶
-
setUp()¶
-
test_bad_file_id()¶ Tests purging a source file.
-
test_no_file_id()¶ Tests purging a source file.
-
test_product_file_id()¶ Tests purging a source file.
-
test_successful(*args, **keywargs)¶ Tests purging a source file.
-
test_successful_db_check(*args, **keywargs)¶ Tests purging a source file.
-
-
class
storage.test.test_views.TestWorkspaceCreateViewV6(methodName='runTest')¶ Bases:
rest_framework.test.APITestCase-
api= u'v6'¶
-
setUp()¶
-
test_configuration_bad_type()¶ Tests calling the create Workspace view with configuration that is not a dict.
-
test_invalid_configuration()¶ Tests calling the create Workspace view with invalid configuration.
-
test_missing_configuration()¶ Tests calling the create Workspace view with missing configuration.
-
test_successful()¶ Tests calling the create Workspace view successfully.
-
-
class
storage.test.test_views.TestWorkspaceDetailsViewV6(methodName='runTest')¶ Bases:
rest_framework.test.APITestCase-
api= u'v6'¶
-
setUp()¶
-
test_edit_bad_config()¶ Tests attempting to edit a workspace using an invalid configuration
-
test_edit_config()¶ Tests editing the configuration of a workspace
-
test_edit_simple()¶ Tests editing only the basic attributes of a workspace
-
test_not_found()¶ Tests successfully calling the get workspace details view with a workspace id that does not exist.
-
test_successful()¶ Tests successfully calling the get workspace details view.
-
-
class
storage.test.test_views.TestWorkspacesValidationViewV6(methodName='runTest')¶ Bases:
rest_framework.test.APITestCaseTests related to the workspaces validation endpoint
-
api= u'v6'¶
-
setUp()¶
-
test_configuration_bad_type()¶ Tests validating a new workspace with configuration that is not a dict.
-
test_invalid_configuration()¶ Tests validating a new workspace with invalid configuration.
-
test_missing_configuration()¶ Tests validating a new workspace with missing configuration.
-
test_successful()¶ Tests validating a new workspace.
-
test_warnings()¶ Tests validating a new workspace where the broker type is changed.
-
-
class
storage.test.test_views.TestWorkspacesViewV6(methodName='runTest')¶ Bases:
rest_framework.test.APITestCase-
api= u'v6'¶
-
setUp()¶
-
test_name()¶ Tests successfully calling the workspaces view filtered by workspace name.
-
test_reverse_sorting()¶ Tests custom sorting in reverse.
-
test_sorting()¶ Tests custom sorting.
-
test_successful()¶ Tests successfully calling the get all workspaces view.
-
storage.test.utils module¶
Defines utility methods for testing files and workspaces
-
storage.test.utils.create_country(name=None, fips=u'TT', gmi=u'TT', iso2=u'TT', iso3=u'TST', iso_num=0, border=None, effective=None)¶ Creates a country data model for unit testing
Returns: The file model Return type: storage.models.CountryData
-
storage.test.utils.create_file(file_name=u'my_test_file.txt', file_type=u'SOURCE', media_type=u'text/plain', file_size=100, data_type_tags=[], file_path=None, workspace=None, is_deleted=False, uuid=u'', last_modified=None, data_started=None, data_ended=None, source_started=None, source_ended=None, source_sensor_class=None, source_sensor=None, source_collection=None, source_task=None, geometry=None, center_point=None, meta_data={}, countries=None, job_exe=None, job_output=None, recipe=None, recipe_node=None, batch=None, is_superseded=False, superseded=None)¶ Creates a Scale file model for unit testing
Returns: The file model Return type: storage.models.ScaleFile
-
storage.test.utils.create_workspace(name=None, title=None, json_config=None, base_url=None, is_active=True, deprecated=None)¶ Creates a workspace model for unit testing
Returns: The workspace model Return type: storage.models.Workspace