The congress.tests.policy_engines.test_agnostic Module

class congress.tests.policy_engines.test_agnostic.TestActionExecution(*args, **kwargs)

Bases: congress.tests.base.TestCase

setUp()
test_disabled_execute_action()
test_disjunction()
test_insert_data_insert_rule()
test_insert_data_insert_rule_delete_data()
test_insert_data_insert_rule_delete_rule()
test_insert_data_insert_rule_noop_insert()
test_insert_rule_insert_data()
test_multiple_instances()
class congress.tests.policy_engines.test_agnostic.TestArity(*args, **kwargs)

Bases: congress.tests.base.TestCase

test_complex_table()
test_modals()
test_same_table_diff_policies()
class congress.tests.policy_engines.test_agnostic.TestDelegation(*args, **kwargs)

Bases: congress.tests.base.TestCase

Tests for Runtime’s delegation functionality.

test_subpolicy()
test_subpolicy_layers()
test_subpolicy_multiple()
test_subpolicy_prohibited()
class congress.tests.policy_engines.test_agnostic.TestDependencyGraph(*args, **kwargs)

Bases: congress.tests.base.TestCase

test_atom_deletion()
test_atom_insert()
test_fact_insert()
test_rule_noop()
class congress.tests.policy_engines.test_agnostic.TestDisabledRules(*args, **kwargs)

Bases: congress.tests.base.SqlTestCase

Tests for Runtime’s ability to enable/disable rules.

test_delete_enabled()
test_delete_errors()
test_delete_policy_while_disabled_events_outstanding()

Test deleting policy while there are disabled_events outstanding.

test_delete_set_schema_disabled()
test_delete_set_schema_errors()
test_disallow_schema_change()
test_insert_disabled()
test_insert_enabled()
test_insert_errors()
test_insert_inferred_schema_errors()
test_insert_set_schema_disabled()
test_insert_set_schema_disabled_multiple()
test_insert_set_schema_errors()
test_insert_without_datasource_policy()
test_persistent_insert_disabled()

Test that persistent_insert_rule errors on IncompleteSchemaException

When a table schema is not available, named column references are permitted but disabled in non-persistent rule insert to allow for late-arriving schema when importing rules already in DB. This behavior is not necessary in persistent_insert.

test_set_schema_unknown_policy()
class congress.tests.policy_engines.test_agnostic.TestMultipolicyRules(*args, **kwargs)

Bases: congress.tests.base.TestCase

test_built_in()

Test that built_in function works.

test_dependency_graph()

Test that dependency graph gets updated correctly.

test_dependency_graph_policy_deletion()
test_external()

Test ability to write rules that span multiple policies.

test_external_current()

Test ability to write rules that span multiple policies.

test_ignore_local()

Test ability to write rules that span multiple policies.

test_local()

Test ability to write rules that span multiple policies.

test_multi_external()

Test multiple rules that span multiple policies.

test_multiple_external()

Test ability to write rules that span multiple policies.

test_multiple_levels_external()

Test ability to write rules that span multiple policies.

test_multipolicy_action_errors()

Test errors arising from rules in action policies.

test_multipolicy_head()

Test SELECT with different policy in the head.

test_multipolicy_normal_errors()

Test errors arising from rules in multiple policies.

test_negation()

Test that negation when applied to a different policy works.

test_same_rules()

Test that same rule insertion can be correctly dealt with.

test_schema_check()

Test that schema check in multiple policies works.

class congress.tests.policy_engines.test_agnostic.TestPolicyCreationDeletion(*args, **kwargs)

Bases: congress.tests.base.TestCase

test_policy_creation_after_ref()

Test ability to write rules that span multiple policies.

test_policy_deletion_after_ref()

Test ability to write rules that span multiple policies.

test_policy_deletion_dependency_graph()

Ensure dependency graph is properly updated when deleting policy.

class congress.tests.policy_engines.test_agnostic.TestRuntime(*args, **kwargs)

Bases: congress.tests.base.TestCase

Tests for Runtime that are not specific to any theory.

check_equal(actual_string, correct_string, msg)
test_cross_policy_rule()

Test rule that refer to table from another policy.

test_get_tablename()
test_initialize_tables()

Test initialize_tables() functionality of agnostic.

test_multi_policy()

Test ability to create/delete multiple policies.

test_multi_policy_update()

Test updates that apply to multiple policies.

test_persistent_create_policy(*args, **keywargs)
test_persistent_create_policy_with_db_exception(*args, **keywargs)
test_policy_errors()

Test errors for multiple policies.

test_policy_types()

Test types for multiple policies.

test_single_policy()

Test ability to create/delete single policies.

test_tablenames()
test_tablenames_theory_name()
test_theory_inclusion()

Test evaluation routines when one theory includes another.

test_wrong_arity_index()
class congress.tests.policy_engines.test_agnostic.TestSelect(*args, **kwargs)

Bases: congress.tests.base.TestCase

test_no_dups()
class congress.tests.policy_engines.test_agnostic.TestSimulate(*args, **kwargs)

Bases: congress.tests.base.TestCase

ACTION_THEORY = 'test_action'
DEFAULT_THEORY = 'test_default'
check(run, action_sequence, query, correct, msg, delta=False)
create(action_code, class_code, theories=None)
prep_runtime(code=None, msg=None, target=None, theories=None)
test_action_sequence()

Test sequence updates with actions.

test_complex_sequence()

Test more complex sequences of updates.

test_delta_add()

Test when asking for changes in query.

test_delta_add_delete()

Test when asking for changes in query.

test_delta_delete()

Test when asking for changes in query.

test_duplicates()
test_key_value_schema()

Test action of key/value updates.

test_multipolicy_action_sequence()

Test sequence updates with actions that impact multiple policies.

test_multipolicy_state_1()

Test update sequence affecting datasources.

test_multipolicy_state_2()

Test update sequence affecting datasources.

test_multipolicy_state_3()

Test update sequence affecting datasources.

test_state_rule_sequence()

Test state and rule update sequences.

class congress.tests.policy_engines.test_agnostic.TestTriggerRegistry(*args, **kwargs)

Bases: congress.tests.base.TestCase

setUp()
test_basic_dependency()
test_complex_dependency()
test_modals()
test_register()
test_trigger()
test_triggers_by_table()
test_unregister()
class congress.tests.policy_engines.test_agnostic.TestTriggers(*args, **kwargs)

Bases: congress.tests.base.TestCase

class MyObject

Bases: object

A class with methods that have side-effects.

equal(realold, realnew, old, new)

Used for checking if function is invoked with correct args.

increment()

Used for counting number of times function invoked.

TestTriggers.test_anti_dependency()
TestTriggers.test_batch_change()
TestTriggers.test_delete_data()
TestTriggers.test_dependency()
TestTriggers.test_dependency_batch()
TestTriggers.test_dependency_batch_delete()
TestTriggers.test_dependency_batch_insert()
TestTriggers.test_empty()
TestTriggers.test_empty2()
TestTriggers.test_empty3()
TestTriggers.test_initialize()
TestTriggers.test_modal()
TestTriggers.test_multi_dependency()
TestTriggers.test_multi_policies()
TestTriggers.test_negation()
TestTriggers.test_nochange()
TestTriggers.test_old_new_correctness()
TestTriggers.test_sequence()
TestTriggers.test_unregister()