chapps.tests.test_adapter.test_adapter module

Tests of CHAPPS adapters module

class chapps.tests.test_adapter.test_adapter.Test_PolicyConfigAdapter[source]

Bases: object

test_adapter_superclass(mock_dbmodule)[source]

Verify that the adapter stores instance data and attempts to open a database connection.

test_create_user_table(database_fixture, finalizing_pcadapter)[source]
class chapps.tests.test_adapter.test_adapter.Test_MariaDBQuotaAdapter[source]

Bases: object

test_initialize_tables_default(finalizing_mdbqadapter, database_fixture)[source]

Verify that MDBQA’s table initialization works properly

test_initialize_tables_with_quotas(finalizing_mdbqadapter, database_fixture)[source]

Verify that MDBQA’s table initialization works properly

test_finalize(mdbqadapter_fixture)[source]

Verify that MDBQA’s finalize routine closes the database connection

test_quota_for_user(populated_database_fixture, finalizing_mdbqadapter)[source]

Verify that MDBQA.quota_for_user returns the expected quota for an email

test_quota_for_nonexistent_user(populated_database_fixture, finalizing_mdbqadapter)[source]

Verify that MDBQA.quota_for_user returns None when the email is not found in the database.

test_quota_dump(populated_database_fixture, finalizing_mdbqadapter)[source]

Verify that MDBQA._quota_search returns rows for all entries in the quota_user table if no list is specified

Verify that MDBQA._quota_search returns rows for all valid email addresses

test_quota_search_accuracy(populated_database_fixture, finalizing_mdbqadapter, test_emails)[source]

Verify that MDBQA._quota_search produces accurate results

test_MDBQA_quota_dict(populated_database_fixture, finalizing_mdbqadapter, test_emails)[source]

Verify that MDBQA.quota_dict returns a dict full of quotas

test_quota_map(populated_database_fixture, finalizing_mdbqadapter, test_emails, mock_mapping)[source]

Verify that MDBQA.quota_map() applies the function to all results from the query

test_quota_map_noncallable(populated_database_fixture, finalizing_mdbqadapter)[source]

Verify that when MDBQA.quota_map() is handed some non-callable as its first non-self argument, it will raise a ValueError

class chapps.tests.test_adapter.test_adapter.Test_MariaDBSenderDomainAuthAdapter[source]

Bases: object

test_initialize_tables(finalizing_mdbsdaadapter, database_fixture)[source]

Verify that MDBSDAA’s table initialization works properly

test_check_domain_for_user(finalizing_mdbsdaadapter, populated_database_fixture)[source]

GIVEN a user has an entry in the database WHEN that user tries to send an email for a domain they are linked to THEN return a True result

test_check_email_for_user(finalizing_mdbsdaadapter, populated_database_fixture)[source]
test_check_domain_for_unauth_user(finalizing_mdbsdaadapter, populated_database_fixture)[source]

GIVEN a user has an entry in the database WHEN that user tries to send an email for a domain they are not linked to THEN return a False result

test_check_domain_for_nonexistent_user(finalizing_mdbsdaadapter, populated_database_fixture)[source]

GIVEN a user has no entry in the database WHEN that user tries to send an email for any domain THEN return a False result

class chapps.tests.test_adapter.test_adapter.Test_MariaDBInboundFlagsAdapter[source]

Bases: object

test_greylisting_flag_set(finalizing_mdbifadapter, populated_database_fixture_with_extras, greylisting_domain)[source]
GIVEN

a domain has greylisting option set ON

WHEN

the adapter is asked about that option

THEN

the adapter should return True

test_greylisting_flag_unset(finalizing_mdbifadapter, populated_database_fixture_with_extras, no_options_domain)[source]
GIVEN

a domain has greylisting option set OFF

WHEN

the adapter is asked about that option

THEN

the adapter should return False

test_spf_flag_set(finalizing_mdbifadapter, populated_database_fixture_with_extras, spf_domain)[source]
GIVEN

a domain has spf option set ON

WHEN

the adapter is asked about that option

THEN

the adapter should return True

test_spf_flag_unset(finalizing_mdbifadapter, populated_database_fixture_with_extras, no_options_domain)[source]
GIVEN

a domain has spf option set ON

WHEN

the adapter is asked about that option

THEN

the adapter should return True