'Test a mapping with empty blacklist specified.
Not adding a ``blacklist`` keyword to the mapping rules has the same
effect as adding an empty ``blacklist``.
In both cases, the mapping engine will not discard any groups that are
associated with apache environment variables.
This test checks scenario where an empty blacklist was specified.
Expected result is to allow any value.
The test scenario is as follows:
- Create group ``EXISTS``
- Create group ``NO_EXISTS``
- Set mapping rules for existing IdP with a blacklist
that passes through as REMOTE_USER_GROUPS
- Issue unscoped token with groups  ``EXISTS`` and ``NO_EXISTS``
assigned'

def test_empty_blacklist_passess_all_values(self):

    domain_id = self.domainA['id']
    domain_name = self.domainA['name']
    group_exists = unit.new_group_ref(domain_id=domain_id, name='EXISTS')
    group_exists = self.identity_api.create_group(group_exists)
    group_no_exists = unit.new_group_ref(domain_id=domain_id, name='NO_EXISTS')
    group_no_exists = self.identity_api.create_group(group_no_exists)
    group_ids = set([group_exists['id'], group_no_exists['id']])
    rules = {'rules': [{'local': [{'user': {'name': '{0}', 'id': '{0}'}}], 'remote': [{'type': 'REMOTE_USER'}]}, {'local': [{'groups': '{0}', 'domain': {'name': domain_name}}], 'remote': [{'type': 'REMOTE_USER_GROUPS', 'blacklist': []}]}]}
    self.federation_api.update_mapping(self.mapping['id'], rules)
    r = self._issue_unscoped_token(assertion='UNMATCHED_GROUP_ASSERTION')
    assigned_group_ids = r.json['token']['user']['OS-FEDERATION']['groups']
    self.assertEqual(len(group_ids), len(assigned_group_ids))
    for group in assigned_group_ids:
        self.assertIn(group['id'], group_ids)
