Tests Package¶
Submodules¶
Admin Views¶
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
- class seed.tests.test_admin_views.AdminViewsTest(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_add_org()¶
Happy path test for creating a new org.
- test_add_org_dupe()¶
Trying to create an org with a dupe name fails.
- test_add_user_existing_org()¶
Test creating a new user, adding them to an existing org in the process.
- test_add_user_new_org()¶
Create a new user and a new org at the same time.
- test_add_user_no_org()¶
Should not be able to create a new user without either selecting or creating an org at the same time.
- test_signup_process()¶
Simulates the entire new user signup process, from initial account creation by an admin to receiving the signup email to confirming the account and setting a password.
- test_signup_process_force_lowercase_email()¶
Simulates the signup and login forcing login username to lowercase
Decorators¶
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
- class seed.tests.test_decorators.ClassDecoratorTests(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
- test_ajax_request_class_dict()¶
- test_ajax_request_class_dict_status_error()¶
- test_ajax_request_class_dict_status_false()¶
- test_ajax_request_class_format_type()¶
- test_require_organization_id_class_no_org_id()¶
- test_require_organization_id_class_org_id()¶
- test_require_organization_id_class_org_id_not_int()¶
- class seed.tests.test_decorators.RequireOrganizationIDTests(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_require_organization_id_fail_no_key()¶
- test_require_organization_id_fail_not_numeric()¶
- test_require_organization_id_success_integer()¶
- test_require_organization_id_success_string()¶
- class seed.tests.test_decorators.TestDecorators(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
Tests for locking tasks and reporting progress.
- locked = 1¶
- pk = 34¶
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_get_prog_key()¶
We format our cache key properly.
- test_increment_cache()¶
Sum our progress by increments properly.
- test_locking()¶
Make sure we indicate we’re locked if and only if we’re inside the function.
- test_locking_w_exception()¶
Make sure we release our lock if we have had an exception.
- test_progress()¶
When a task finishes, it increments the progress counter properly.
- unlocked = 0¶
- exception seed.tests.test_decorators.TestException¶
Bases:
Exception
Exporters¶
Models¶
Tasks¶
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
Views¶
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
- class seed.tests.test_views.GetDatasetsViewsTests(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_delete_dataset()¶
- test_get_dataset()¶
- test_get_datasets()¶
- test_get_datasets_count()¶
- test_get_datasets_count_invalid()¶
- test_update_dataset()¶
- class seed.tests.test_views.ImportFileViewsTests(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_delete_file()¶
- test_get_import_file()¶
- test_get_matching_and_geocoding_results()¶
- class seed.tests.test_views.InventoryViewTests(methodName='runTest')¶
Bases:
seed.tests.util.AssertDictSubsetMixin
,seed.tests.util.DeleteModelsTestCase
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_get_cycles()¶
- test_get_properties()¶
- test_get_properties_cycle_id()¶
- test_get_properties_empty_page()¶
- test_get_properties_page_not_an_integer()¶
- test_get_properties_pint_fields()¶
- test_get_properties_profile_id()¶
- test_get_properties_property_extra_data()¶
- test_get_properties_select_all()¶
- test_get_properties_taxlot_extra_data()¶
- test_get_properties_with_taxlots()¶
- test_get_properties_with_taxlots_with_footprints()¶
- test_get_properties_wrong_query_params()¶
- test_get_property()¶
- test_get_property_columns()¶
- test_get_property_multiple_taxlots()¶
- test_get_taxlot()¶
- test_get_taxlot_columns()¶
- test_get_taxlots()¶
- test_get_taxlots_empty_page()¶
- test_get_taxlots_extra_data()¶
- test_get_taxlots_multiple_taxlots()¶
- test_get_taxlots_no_cycle_id()¶
- test_get_taxlots_page_not_an_integer()¶
- test_get_taxlots_profile_id()¶
- test_postoffice()¶
- test_update_pint_fields_with_modified_display_settings()¶
- class seed.tests.test_views.MainViewTests(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_home()¶
- class seed.tests.test_views.TestMCMViews(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
- assert_expected_mappings(actual, expected)¶
For each k,v pair of form column_name: [dest_col, confidence] in actual, assert that expected contains the same column_name and dest_col mapping.
- expected_mappings = {'address': ['owner_address', 70], 'building id': ['Building air leakage', 64], 'name': ['Name of Audit Certification Holder', 47], 'year built': ['year_built', 50]}¶
- raw_columns_expected = {'raw_columns': ['name', 'address', 'year built', 'building id'], 'status': 'success'}¶
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_create_dataset()¶
tests the create_dataset view, allows duplicate dataset names
- test_get_column_mapping_suggestions()¶
- test_get_column_mapping_suggestions_pm_file()¶
- test_get_column_mapping_suggestions_with_columns()¶
- test_get_raw_column_names()¶
Good case for
get_raw_column_names
.
- test_progress()¶
Make sure we retrieve data from cache properly.
- test_save_column_mappings()¶
- test_save_column_mappings_idempotent()¶
We need to make successive calls to save_column_mappings.
Tests¶
Utils¶
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. See also https://github.com/seed-platform/seed/main/LICENSE.md
- class seed.tests.util.AssertDictSubsetMixin¶
Bases:
object
- assertDictContainsSubset(subset, dictionary)¶
Checks whether dictionary is a superset of subset
This is a necessary polyfill b/c assertDictContainsSubset was deprecated and I believe it’s much more readable compared to the implementation below
- class seed.tests.util.DataMappingBaseTestCase(methodName='runTest')¶
Bases:
seed.tests.util.DeleteModelsTestCase
Base Test Case Class to handle data import
- create_import_file(user, org, cycle, source_type=0, data_state=1)¶
- set_up(import_file_source_type, user_name='test_user@demo.com', user_password='test_pass')¶
- class seed.tests.util.DeleteModelsTestCase(methodName='runTest')¶
Bases:
django.test.testcases.TestCase
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- tearDown()¶
Hook method for deconstructing the test fixture after testing it.