Tests Package

Admin Views

class seed.tests.test_admin_views.AdminViewsTest(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()
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

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()
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()
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: exceptions.Exception

Exporters

Models

Tasks

class seed.tests.test_tasks.TestTasks(methodName='runTest')

Bases: django.test.testcases.TestCase

Tests for dealing with SEED related tasks.

setUp()
test_delete_organization()
test_delete_organization_doesnt_delete_user_if_multiple_memberships()

Deleting an org should not delete the orgs users if the user belongs to many orgs.

Views

class seed.tests.test_views.DefaultColumnsViewTests(methodName='runTest')

Bases: django.test.testcases.TestCase

Tests of the SEED default custom saved columns

setUp()
tearDown()
test_get_columns()
test_get_default_columns_initial_state()
test_get_default_columns_with_set_columns()
test_set_default_columns()
class seed.tests.test_views.GetDatasetsViewsTests(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()
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()
test_delete_file()
test_get_import_file()
test_get_matching_results()
class seed.tests.test_views.InventoryViewTests(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()
tearDown()
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_property_extra_data()
test_get_properties_taxlot_extra_data()
test_get_properties_with_taxlots()
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_missing_jurisdiction_tax_lot_id()
test_get_taxlots_multiple_taxlots()
test_get_taxlots_no_cycle_id()
test_get_taxlots_page_not_an_integer()
class seed.tests.test_views.MainViewTests(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()
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 = {u'year built': [u'year_built', 50], u'building id': [u'Building air leakage', 64], u'name': [u'Name of Audit Certification Holder', 47], u'address': [u'owner_address', 70]}
raw_columns_expected = {u'status': u'success', u'raw_columns': [u'name', u'address', u'year built', u'building id']}
setUp()
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

class seed.tests.tests.ComplianceTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

test_basic_compliance_creation()
class seed.tests.tests.ProjectTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

test_basic_project_creation()
class seed.tests.tests.UtilsTests(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()
test_get_buildings_count_for_user()

Utils

class seed.tests.util.FakeClient

Bases: object

An extremely light-weight test client.

get(view_func, data, headers=None, **kwargs)
post(view_func, data, headers=None, **kwargs)
class seed.tests.util.FakeRequest(data=None, headers=None, user=None, method='POST', **kwargs)

Bases: object

A simple request stub.

GET = {}
META = {'REMOTE_ADDR': '127.0.0.1'}
POST = {}
body = None
path = 'fake_login_path'
seed.tests.util.make_fake_property(import_file, init_data, bs_type, is_canon=False, org=None)

For making fake mapped PropertyState to test matching against.