'Test varius mapping options and how users are identified.
This test calls mapped.setup_username() for propagating user object.
Test plan:
- Check if the user has proper domain (\'federated\') set
- Check if the user has property type set (\'ephemeral\')
- Check if user\'s name is properly mapped from the assertion
- Check if unique_id is properly set and equal to display_name,
as it was not explicitly specified in the mapping.'

def test_user_identifications_name(self):

    mapping = mapping_fixtures.MAPPING_USER_IDS
    rp = mapping_utils.RuleProcessor(FAKE_MAPPING_ID, mapping['rules'])
    assertion = mapping_fixtures.CONTRACTOR_ASSERTION
    mapped_properties = rp.process(assertion)
    self.assertIsNotNone(mapped_properties)
    self.assertValidMappedUserObject(mapped_properties)
    self.assertEqual('jsmith', mapped_properties['user']['name'])
    (unique_id, display_name) = mapped.get_user_unique_id_and_display_name({}, mapped_properties)
    self.assertEqual('jsmith', unique_id)
    self.assertEqual('jsmith', display_name)
