'Test that we correctly combine assignments for a tree.
In this test we want to ensure that when asking for a list of
assignments in a subtree, any assignments inherited from above the
subtree are correctly combined with any assignments within the subtree
itself.'

def test_list_effective_assignments_for_tree_with_mixed_assignments(self):

    test_plan = {'entities': {'domains': {'projects': {'project': [{'project': 2}, {'project': 2}]}, 'users': 2, 'groups': 1}, 'roles': 4}, 'group_memberships': [{'group': 0, 'users': [0, 1]}], 'assignments': [{'user': 0, 'role': 0, 'project': 0, 'inherited_to_projects': True}, {'group': 0, 'role': 1, 'project': 0, 'inherited_to_projects': True}, {'user': 0, 'role': 2, 'project': 1, 'inherited_to_projects': True}, {'user': 0, 'role': 3, 'project': 2}, {'user': 0, 'role': 2, 'project': 5}, {'user': 0, 'role': 3, 'project': 4}], 'tests': [{'params': {'project': 1, 'user': 0, 'effective': True, 'include_subtree': True}, 'results': [{'user': 0, 'role': 0, 'project': 1, 'indirect': {'project': 0}}, {'user': 0, 'role': 0, 'project': 2, 'indirect': {'project': 0}}, {'user': 0, 'role': 0, 'project': 3, 'indirect': {'project': 0}}, {'user': 0, 'role': 1, 'project': 1, 'indirect': {'project': 0, 'group': 0}}, {'user': 0, 'role': 1, 'project': 2, 'indirect': {'project': 0, 'group': 0}}, {'user': 0, 'role': 1, 'project': 3, 'indirect': {'project': 0, 'group': 0}}, {'user': 0, 'role': 2, 'project': 2, 'indirect': {'project': 1}}, {'user': 0, 'role': 2, 'project': 3, 'indirect': {'project': 1}}, {'user': 0, 'role': 3, 'project': 2}]}]}
    self.execute_assignment_plan(test_plan)
