Ejemplo n.º 1
0
    def test_empty_registry(self):
        """Check output when the registry is empty"""

        self.db.clear()

        exporter = SortingHatIdentitiesExporter(self.db)
        dump = exporter.export()
        obj = json.loads(dump)

        self.assertEqual(obj['source'], None)
        self.assertIn('time', obj)
        self.assertEqual(len(obj['uidentities']), 0)
        self.assertEqual(len(obj['blacklist']), 0)
Ejemplo n.º 2
0
    def test_source(self):
        """Check output when source is given"""

        exporter = SortingHatIdentitiesExporter(self.db)

        # There's no identity with this source, thus the result
        # should be empty
        dump = exporter.export(source='its')
        obj = json.loads(dump)

        self.assertEqual(obj['source'], 'its')
        self.assertEqual(len(obj['uidentities']), 0)

        # Using 'unknown' source should return the uidentity
        # of Jane Roe
        dump = exporter.export(source='unknown')
        obj = json.loads(dump)

        self.assertEqual(obj['source'], 'unknown')

        uidentities = obj['uidentities']
        self.assertEqual(len(uidentities), 1)

        uid = uidentities['17ab00ed3825ec2f50483e33c88df223264182ba']
        self.assertEqual(uid['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(len(uid['identities']), 3)
        self.assertEqual(len(uid['enrollments']), 3)

        # Check blacklist
        blacklist = obj['blacklist']
        self.assertEqual(len(blacklist), 2)

        bl0 = blacklist[0]
        self.assertEqual(bl0, 'John Smith')

        bl1 = blacklist[1]
        self.assertEqual(bl1, '*****@*****.**')
Ejemplo n.º 3
0
    def test_source(self):
        """Check output when source is given"""

        exporter = SortingHatIdentitiesExporter(self.db)

        # There's no identity with this source, thus the result
        # should be empty
        dump = exporter.export(source='its')
        obj = json.loads(dump)

        self.assertEqual(obj['source'], 'its')
        self.assertEqual(len(obj['uidentities']), 0)

        # Using 'unknown' source should return the uidentity
        # of Jane Roe
        dump = exporter.export(source='unknown')
        obj = json.loads(dump)

        self.assertEqual(obj['source'], 'unknown')

        uidentities = obj['uidentities']
        self.assertEqual(len(uidentities), 1)

        uid = uidentities['52e0aa0a14826627e633fd15332988686b730ab3']
        self.assertEqual(uid['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(len(uid['identities']), 3)
        self.assertEqual(len(uid['enrollments']), 3)

        # Check blacklist
        blacklist = obj['blacklist']
        self.assertEqual(len(blacklist), 2)

        bl0 = blacklist[0]
        self.assertEqual(bl0, 'John Smith')

        bl1 = blacklist[1]
        self.assertEqual(bl1, '*****@*****.**')
Ejemplo n.º 4
0
    def test_export(self):
        """Test the output from export"""

        exporter = SortingHatIdentitiesExporter(self.db)
        dump = exporter.export()

        # The best way to check this is to build a JSON object
        # with the output from export()
        obj = json.loads(dump)

        self.assertEqual(obj['source'], None)
        self.assertIn('time', obj)

        uidentities = obj['uidentities']
        self.assertEqual(len(uidentities), 3)

        # Null identity
        uid0 = uidentities['0000000000000000000000000000000000000000']
        self.assertEqual(uid0['uuid'],
                         '0000000000000000000000000000000000000000')

        self.assertEqual(uid0['profile']['name'], None)
        self.assertEqual(uid0['profile']['email'], None)
        self.assertEqual(uid0['profile']['gender'], None)
        self.assertEqual(uid0['profile']['gender_acc'], None)
        self.assertEqual(uid0['profile']['is_bot'], False)
        self.assertEqual(len(uid0['identities']), 0)

        # Jane Roe
        uid1 = uidentities['17ab00ed3825ec2f50483e33c88df223264182ba']
        self.assertEqual(uid1['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')

        self.assertEqual(uid1['profile']['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(uid1['profile']['name'], 'Jane Roe')
        self.assertEqual(uid1['profile']['email'], '*****@*****.**')
        self.assertEqual(uid1['profile']['gender'], None)
        self.assertEqual(uid1['profile']['gender_acc'], None)
        self.assertEqual(uid1['profile']['is_bot'], False)
        self.assertEqual(uid1['profile']['country']['alpha3'], 'USA')
        self.assertEqual(uid1['profile']['country']['code'], 'US')
        self.assertEqual(uid1['profile']['country']['name'],
                         'United States of America')

        ids = uid1['identities']
        self.assertEqual(len(ids), 3)

        id0 = ids[0]
        self.assertEqual(id0['id'], '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(id0['name'], 'Jane Roe')
        self.assertEqual(id0['email'], '*****@*****.**')
        self.assertEqual(id0['username'], 'jroe')
        self.assertEqual(id0['source'], 'scm')
        self.assertEqual(id0['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')

        id1 = ids[1]
        self.assertEqual(id1['id'], '22d1b20763c6f5822bdda8508957486c547bb9de')
        self.assertEqual(id1['name'], None)
        self.assertEqual(id1['email'], '*****@*****.**')
        self.assertEqual(id1['username'], None)
        self.assertEqual(id1['source'], 'unknown')
        self.assertEqual(id1['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')

        id2 = ids[2]
        self.assertEqual(id2['id'], '322397ed782a798ffd9d0bc7e293df4292fe075d')
        self.assertEqual(id2['name'], None)
        self.assertEqual(id2['email'], '*****@*****.**')
        self.assertEqual(id2['username'], None)
        self.assertEqual(id2['source'], 'scm')
        self.assertEqual(id2['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')

        enrollments = uid1['enrollments']
        self.assertEqual(len(enrollments), 3)

        rol0 = enrollments[0]
        self.assertEqual(rol0['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(rol0['organization'], 'Bitergia')
        self.assertEqual(rol0['start'], '1999-01-01T00:00:00')
        self.assertEqual(rol0['end'], '2000-01-01T00:00:00')

        rol1 = enrollments[1]
        self.assertEqual(rol1['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(rol1['organization'], 'Bitergia')
        self.assertEqual(rol1['start'], '2006-01-01T00:00:00')
        self.assertEqual(rol1['end'], '2008-01-01T00:00:00')

        rol2 = enrollments[2]
        self.assertEqual(rol2['uuid'],
                         '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(rol2['organization'], 'Example')
        self.assertEqual(rol2['start'], '1900-01-01T00:00:00')
        self.assertEqual(rol2['end'], '2100-01-01T00:00:00')

        # John Smith
        uid2 = uidentities['a9b403e150dd4af8953a52a4bb841051e4b705d9']
        self.assertEqual(uid2['uuid'],
                         'a9b403e150dd4af8953a52a4bb841051e4b705d9')

        self.assertEqual(uid2['profile']['uuid'],
                         'a9b403e150dd4af8953a52a4bb841051e4b705d9')
        self.assertEqual(uid2['profile']['name'], None)
        self.assertEqual(uid2['profile']['email'], '*****@*****.**')
        self.assertEqual(uid2['profile']['gender'], 'male')
        self.assertEqual(uid2['profile']['gender_acc'], 100)
        self.assertEqual(uid2['profile']['is_bot'], True)

        ids = uid2['identities']
        self.assertEqual(len(ids), 2)

        id0 = ids[0]
        self.assertEqual(id0['id'], '880b3dfcb3a08712e5831bddc3dfe81fc5d7b331')
        self.assertEqual(id0['name'], 'John Smith')
        self.assertEqual(id0['email'], '*****@*****.**')
        self.assertEqual(id0['username'], None)
        self.assertEqual(id0['source'], 'scm')
        self.assertEqual(id0['uuid'],
                         'a9b403e150dd4af8953a52a4bb841051e4b705d9')

        id1 = ids[1]
        self.assertEqual(id1['id'], 'a9b403e150dd4af8953a52a4bb841051e4b705d9')
        self.assertEqual(id1['name'], 'John Smith')
        self.assertEqual(id1['email'], '*****@*****.**')
        self.assertEqual(id1['username'], 'jsmith')
        self.assertEqual(id1['source'], 'scm')
        self.assertEqual(id1['uuid'],
                         'a9b403e150dd4af8953a52a4bb841051e4b705d9')

        enrollments = uid2['enrollments']
        self.assertEqual(len(enrollments), 1)

        rol0 = enrollments[0]
        self.assertEqual(rol0['uuid'],
                         'a9b403e150dd4af8953a52a4bb841051e4b705d9')
        self.assertEqual(rol0['organization'], 'Example')
        self.assertEqual(rol0['start'], '1900-01-01T00:00:00')
        self.assertEqual(rol0['end'], '2100-01-01T00:00:00')

        # Check blacklist
        blacklist = obj['blacklist']
        self.assertEqual(len(blacklist), 2)

        bl0 = blacklist[0]
        self.assertEqual(bl0, 'John Smith')

        bl1 = blacklist[1]
        self.assertEqual(bl1, '*****@*****.**')
Ejemplo n.º 5
0
    def test_export(self):
        """Test the output from export"""

        exporter = SortingHatIdentitiesExporter(self.db)
        dump = exporter.export()

        # The best way to check this is to build a JSON object
        # with the output from export()
        obj = json.loads(dump)

        self.assertEqual(obj['source'], None)
        self.assertIn('time', obj)

        uidentities = obj['uidentities']
        self.assertEqual(len(uidentities), 3)

        uid0 = uidentities['0000000000000000000000000000000000000000']
        self.assertEqual(uid0['uuid'], '0000000000000000000000000000000000000000')
        self.assertEqual(uid0['profile'], None)
        self.assertEqual(len(uid0['identities']), 0)

        # Jane Roe
        uid1 = uidentities['52e0aa0a14826627e633fd15332988686b730ab3']
        self.assertEqual(uid1['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')

        self.assertEqual(uid1['profile']['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(uid1['profile']['name'], 'Jane Roe')
        self.assertEqual(uid1['profile']['email'], '*****@*****.**')
        self.assertEqual(uid1['profile']['is_bot'], False)
        self.assertEqual(uid1['profile']['country']['alpha3'], 'USA')
        self.assertEqual(uid1['profile']['country']['code'], 'US')
        self.assertEqual(uid1['profile']['country']['name'], 'United States of America')

        ids = uid1['identities']
        self.assertEqual(len(ids), 3)

        id0 = ids[0]
        self.assertEqual(id0['id'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(id0['name'], 'Jane Roe')
        self.assertEqual(id0['email'], '*****@*****.**')
        self.assertEqual(id0['username'], 'jroe')
        self.assertEqual(id0['source'], 'scm')
        self.assertEqual(id0['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')

        id1 = ids[1]
        self.assertEqual(id1['id'], 'cbfb7bd31d556322c640f5bc7b31d58a12b15904')
        self.assertEqual(id1['name'], None)
        self.assertEqual(id1['email'], '*****@*****.**')
        self.assertEqual(id1['username'], None)
        self.assertEqual(id1['source'], 'unknown')
        self.assertEqual(id1['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')

        id2 = ids[2]
        self.assertEqual(id2['id'], 'fef873c50a48cfc057f7aa19f423f81889a8907f')
        self.assertEqual(id2['name'], None)
        self.assertEqual(id2['email'], '*****@*****.**')
        self.assertEqual(id2['username'], None)
        self.assertEqual(id2['source'], 'scm')
        self.assertEqual(id2['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')

        enrollments = uid1['enrollments']
        self.assertEqual(len(enrollments), 3)

        rol0 = enrollments[0]
        self.assertEqual(rol0['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(rol0['organization'], 'Bitergia')
        self.assertEqual(rol0['start'], '1999-01-01T00:00:00')
        self.assertEqual(rol0['end'], '2000-01-01T00:00:00')

        rol1 = enrollments[1]
        self.assertEqual(rol1['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(rol1['organization'], 'Bitergia')
        self.assertEqual(rol1['start'], '2006-01-01T00:00:00')
        self.assertEqual(rol1['end'], '2008-01-01T00:00:00')

        rol2 = enrollments[2]
        self.assertEqual(rol2['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(rol2['organization'], 'Example')
        self.assertEqual(rol2['start'], '1900-01-01T00:00:00')
        self.assertEqual(rol2['end'], '2100-01-01T00:00:00')

        # John Smith
        uid2 = uidentities['03e12d00e37fd45593c49a5a5a1652deca4cf302']
        self.assertEqual(uid2['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')

        self.assertEqual(uid2['profile']['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')
        self.assertEqual(uid2['profile']['name'], None)
        self.assertEqual(uid2['profile']['email'], '*****@*****.**')
        self.assertEqual(uid2['profile']['is_bot'], True)

        ids = uid2['identities']
        self.assertEqual(len(ids), 2)

        id0 = ids[0]
        self.assertEqual(id0['id'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')
        self.assertEqual(id0['name'], 'John Smith')
        self.assertEqual(id0['email'], '*****@*****.**')
        self.assertEqual(id0['username'], 'jsmith')
        self.assertEqual(id0['source'], 'scm')
        self.assertEqual(id0['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')

        id1 = ids[1]
        self.assertEqual(id1['id'], '75d95d6c8492fd36d24a18bd45d62161e05fbc97')
        self.assertEqual(id1['name'], 'John Smith')
        self.assertEqual(id1['email'], '*****@*****.**')
        self.assertEqual(id1['username'], None)
        self.assertEqual(id1['source'], 'scm')
        self.assertEqual(id1['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')

        enrollments = uid2['enrollments']
        self.assertEqual(len(enrollments), 1)

        rol0 = enrollments[0]
        self.assertEqual(rol0['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')
        self.assertEqual(rol0['organization'], 'Example')
        self.assertEqual(rol0['start'], '1900-01-01T00:00:00')
        self.assertEqual(rol0['end'], '2100-01-01T00:00:00')

        # Check blacklist
        blacklist = obj['blacklist']
        self.assertEqual(len(blacklist), 2)

        bl0 = blacklist[0]
        self.assertEqual(bl0, 'John Smith')

        bl1 = blacklist[1]
        self.assertEqual(bl1, '*****@*****.**')
Ejemplo n.º 6
0
    def test_export(self):
        """Test the output from export"""

        exporter = SortingHatIdentitiesExporter(self.db)
        dump = exporter.export()

        # The best way to check this is to build a JSON object
        # with the output from export()
        obj = json.loads(dump)

        self.assertEqual(obj['source'], None)
        self.assertIn('time', obj)

        uidentities = obj['uidentities']
        self.assertEqual(len(uidentities), 3)

        uid0 = uidentities['0000000000000000000000000000000000000000']
        self.assertEqual(uid0['uuid'], '0000000000000000000000000000000000000000')
        self.assertEqual(uid0['profile'], None)
        self.assertEqual(len(uid0['identities']), 0)

        # Jane Roe
        uid1 = uidentities['52e0aa0a14826627e633fd15332988686b730ab3']
        self.assertEqual(uid1['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')

        self.assertEqual(uid1['profile']['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(uid1['profile']['name'], 'Jane Roe')
        self.assertEqual(uid1['profile']['email'], '*****@*****.**')
        self.assertEqual(uid1['profile']['is_bot'], False)
        self.assertEqual(uid1['profile']['country']['alpha3'], 'USA')
        self.assertEqual(uid1['profile']['country']['code'], 'US')
        self.assertEqual(uid1['profile']['country']['name'], 'United States of America')

        ids = uid1['identities']
        self.assertEqual(len(ids), 3)

        id0 = ids[0]
        self.assertEqual(id0['id'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(id0['name'], 'Jane Roe')
        self.assertEqual(id0['email'], '*****@*****.**')
        self.assertEqual(id0['username'], 'jroe')
        self.assertEqual(id0['source'], 'scm')
        self.assertEqual(id0['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')

        id1 = ids[1]
        self.assertEqual(id1['id'], 'cbfb7bd31d556322c640f5bc7b31d58a12b15904')
        self.assertEqual(id1['name'], None)
        self.assertEqual(id1['email'], '*****@*****.**')
        self.assertEqual(id1['username'], None)
        self.assertEqual(id1['source'], 'unknown')
        self.assertEqual(id1['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')

        id2 = ids[2]
        self.assertEqual(id2['id'], 'fef873c50a48cfc057f7aa19f423f81889a8907f')
        self.assertEqual(id2['name'], None)
        self.assertEqual(id2['email'], '*****@*****.**')
        self.assertEqual(id2['username'], None)
        self.assertEqual(id2['source'], 'scm')
        self.assertEqual(id2['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')

        enrollments = uid1['enrollments']
        self.assertEqual(len(enrollments), 3)

        rol0 = enrollments[0]
        self.assertEqual(rol0['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(rol0['organization'], 'Bitergia')
        self.assertEqual(rol0['start'], '1999-01-01T00:00:00')
        self.assertEqual(rol0['end'], '2000-01-01T00:00:00')

        rol1 = enrollments[1]
        self.assertEqual(rol1['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(rol1['organization'], 'Bitergia')
        self.assertEqual(rol1['start'], '2006-01-01T00:00:00')
        self.assertEqual(rol1['end'], '2008-01-01T00:00:00')

        rol2 = enrollments[2]
        self.assertEqual(rol2['uuid'], '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(rol2['organization'], 'Example')
        self.assertEqual(rol2['start'], '1900-01-01T00:00:00')
        self.assertEqual(rol2['end'], '2100-01-01T00:00:00')

        # John Smith
        uid2 = uidentities['03e12d00e37fd45593c49a5a5a1652deca4cf302']
        self.assertEqual(uid2['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')

        self.assertEqual(uid2['profile']['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')
        self.assertEqual(uid2['profile']['name'], None)
        self.assertEqual(uid2['profile']['email'], '*****@*****.**')
        self.assertEqual(uid2['profile']['is_bot'], True)

        ids = uid2['identities']
        self.assertEqual(len(ids), 2)

        id0 = ids[0]
        self.assertEqual(id0['id'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')
        self.assertEqual(id0['name'], 'John Smith')
        self.assertEqual(id0['email'], '*****@*****.**')
        self.assertEqual(id0['username'], 'jsmith')
        self.assertEqual(id0['source'], 'scm')
        self.assertEqual(id0['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')

        id1 = ids[1]
        self.assertEqual(id1['id'], '75d95d6c8492fd36d24a18bd45d62161e05fbc97')
        self.assertEqual(id1['name'], 'John Smith')
        self.assertEqual(id1['email'], '*****@*****.**')
        self.assertEqual(id1['username'], None)
        self.assertEqual(id1['source'], 'scm')
        self.assertEqual(id1['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')

        enrollments = uid2['enrollments']
        self.assertEqual(len(enrollments), 1)

        rol0 = enrollments[0]
        self.assertEqual(rol0['uuid'], '03e12d00e37fd45593c49a5a5a1652deca4cf302')
        self.assertEqual(rol0['organization'], 'Example')
        self.assertEqual(rol0['start'], '1900-01-01T00:00:00')
        self.assertEqual(rol0['end'], '2100-01-01T00:00:00')

        # Check blacklist
        blacklist = obj['blacklist']
        self.assertEqual(len(blacklist), 2)

        bl0 = blacklist[0]
        self.assertEqual(bl0, 'John Smith')

        bl1 = blacklist[1]
        self.assertEqual(bl1, '*****@*****.**')
Ejemplo n.º 7
0
    def test_export(self):
        """Test the output from export"""

        exporter = SortingHatIdentitiesExporter(self.db)
        dump = exporter.export()

        # The best way to check this is to build a JSON object
        # with the output from export()
        obj = json.loads(dump)

        self.assertEqual(obj['source'], None)
        self.assertIn('time', obj)

        uidentities = obj['uidentities']
        self.assertEqual(len(uidentities), 3)

        uid0 = uidentities['0000000000000000000000000000000000000000']
        self.assertEqual(uid0['uuid'], '0000000000000000000000000000000000000000')
        self.assertEqual(uid0['profile'], None)
        self.assertEqual(len(uid0['identities']), 0)

        # Jane Roe
        uid1 = uidentities['17ab00ed3825ec2f50483e33c88df223264182ba']
        self.assertEqual(uid1['uuid'], '17ab00ed3825ec2f50483e33c88df223264182ba')

        self.assertEqual(uid1['profile']['uuid'], '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(uid1['profile']['name'], 'Jane Roe')
        self.assertEqual(uid1['profile']['email'], '*****@*****.**')
        self.assertEqual(uid1['profile']['is_bot'], False)
        self.assertEqual(uid1['profile']['country']['alpha3'], 'USA')
        self.assertEqual(uid1['profile']['country']['code'], 'US')
        self.assertEqual(uid1['profile']['country']['name'], 'United States of America')

        ids = uid1['identities']
        self.assertEqual(len(ids), 3)

        id0 = ids[0]
        self.assertEqual(id0['id'], '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(id0['name'], 'Jane Roe')
        self.assertEqual(id0['email'], '*****@*****.**')
        self.assertEqual(id0['username'], 'jroe')
        self.assertEqual(id0['source'], 'scm')
        self.assertEqual(id0['uuid'], '17ab00ed3825ec2f50483e33c88df223264182ba')

        id1 = ids[1]
        self.assertEqual(id1['id'], '22d1b20763c6f5822bdda8508957486c547bb9de')
        self.assertEqual(id1['name'], None)
        self.assertEqual(id1['email'], '*****@*****.**')
        self.assertEqual(id1['username'], None)
        self.assertEqual(id1['source'], 'unknown')
        self.assertEqual(id1['uuid'], '17ab00ed3825ec2f50483e33c88df223264182ba')

        id2 = ids[2]
        self.assertEqual(id2['id'], '322397ed782a798ffd9d0bc7e293df4292fe075d')
        self.assertEqual(id2['name'], None)
        self.assertEqual(id2['email'], '*****@*****.**')
        self.assertEqual(id2['username'], None)
        self.assertEqual(id2['source'], 'scm')
        self.assertEqual(id2['uuid'], '17ab00ed3825ec2f50483e33c88df223264182ba')

        enrollments = uid1['enrollments']
        self.assertEqual(len(enrollments), 3)

        rol0 = enrollments[0]
        self.assertEqual(rol0['uuid'], '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(rol0['organization'], 'Bitergia')
        self.assertEqual(rol0['start'], '1999-01-01T00:00:00')
        self.assertEqual(rol0['end'], '2000-01-01T00:00:00')

        rol1 = enrollments[1]
        self.assertEqual(rol1['uuid'], '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(rol1['organization'], 'Bitergia')
        self.assertEqual(rol1['start'], '2006-01-01T00:00:00')
        self.assertEqual(rol1['end'], '2008-01-01T00:00:00')

        rol2 = enrollments[2]
        self.assertEqual(rol2['uuid'], '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(rol2['organization'], 'Example')
        self.assertEqual(rol2['start'], '1900-01-01T00:00:00')
        self.assertEqual(rol2['end'], '2100-01-01T00:00:00')

        # John Smith
        uid2 = uidentities['a9b403e150dd4af8953a52a4bb841051e4b705d9']
        self.assertEqual(uid2['uuid'], 'a9b403e150dd4af8953a52a4bb841051e4b705d9')

        self.assertEqual(uid2['profile']['uuid'], 'a9b403e150dd4af8953a52a4bb841051e4b705d9')
        self.assertEqual(uid2['profile']['name'], None)
        self.assertEqual(uid2['profile']['email'], '*****@*****.**')
        self.assertEqual(uid2['profile']['is_bot'], True)

        ids = uid2['identities']
        self.assertEqual(len(ids), 2)

        id0 = ids[0]
        self.assertEqual(id0['id'], '880b3dfcb3a08712e5831bddc3dfe81fc5d7b331')
        self.assertEqual(id0['name'], 'John Smith')
        self.assertEqual(id0['email'], '*****@*****.**')
        self.assertEqual(id0['username'], None)
        self.assertEqual(id0['source'], 'scm')
        self.assertEqual(id0['uuid'], 'a9b403e150dd4af8953a52a4bb841051e4b705d9')

        id1 = ids[1]
        self.assertEqual(id1['id'], 'a9b403e150dd4af8953a52a4bb841051e4b705d9')
        self.assertEqual(id1['name'], 'John Smith')
        self.assertEqual(id1['email'], '*****@*****.**')
        self.assertEqual(id1['username'], 'jsmith')
        self.assertEqual(id1['source'], 'scm')
        self.assertEqual(id1['uuid'], 'a9b403e150dd4af8953a52a4bb841051e4b705d9')

        enrollments = uid2['enrollments']
        self.assertEqual(len(enrollments), 1)

        rol0 = enrollments[0]
        self.assertEqual(rol0['uuid'], 'a9b403e150dd4af8953a52a4bb841051e4b705d9')
        self.assertEqual(rol0['organization'], 'Example')
        self.assertEqual(rol0['start'], '1900-01-01T00:00:00')
        self.assertEqual(rol0['end'], '2100-01-01T00:00:00')

        # Check blacklist
        blacklist = obj['blacklist']
        self.assertEqual(len(blacklist), 2)

        bl0 = blacklist[0]
        self.assertEqual(bl0, 'John Smith')

        bl1 = blacklist[1]
        self.assertEqual(bl1, '*****@*****.**')