'Should return user\'s group Developer.
The EMPLOYEE_ASSERTION_MULTIPLE_GROUPS should successfully have a match
in MAPPING_GROUPS_BLACKLIST. It will test the case where \'blacklist\'
correctly filters out Manager and Developer and only allows Contractor.'

def test_rule_engine_blacklist_and_direct_groups_mapping(self):

    mapping = mapping_fixtures.MAPPING_GROUPS_BLACKLIST
    assertion = mapping_fixtures.EMPLOYEE_ASSERTION_MULTIPLE_GROUPS
    rp = mapping_utils.RuleProcessor(FAKE_MAPPING_ID, mapping['rules'])
    mapped_properties = rp.process(assertion)
    self.assertIsNotNone(mapped_properties)
    reference = {mapping_fixtures.CONTRACTOR_GROUP_NAME: {'name': mapping_fixtures.CONTRACTOR_GROUP_NAME, 'domain': {'id': mapping_fixtures.DEVELOPER_GROUP_DOMAIN_ID}}}
    for rule in mapped_properties['group_names']:
        self.assertDictEqual(reference.get(rule.get('name')), rule)
    self.assertEqual('tbo', mapped_properties['user']['name'])
    self.assertEqual([], mapped_properties['group_ids'])
