'Check Linux users are accurately merged.'

def testUserMergeLinux(self):

    kb = rdf_client.KnowledgeBase()
    self.assertEqual(len(kb.users), 0)
    kb.MergeOrAddUser(rdf_client.User(username='blake', last_logon=1111))
    self.assertEqual(len(kb.users), 1)
    kb.MergeOrAddUser(rdf_client.User(uid='12', username='blake'))
    self.assertEqual(len(kb.users), 1)
    kb.MergeOrAddUser(rdf_client.User(username='blake', uid='13', desktop='/home/blake/Desktop'))
    self.assertEqual(len(kb.users), 2)
    kb.MergeOrAddUser(rdf_client.User(username='newblake', uid='14', desktop='/home/blake/Desktop'))
    self.assertEqual(len(kb.users), 3)
    (new_attrs, conflicts) = kb.MergeOrAddUser(rdf_client.User(username='newblake', desktop='/home/blakey/Desktop'))
    self.assertEqual(len(kb.users), 3)
    self.assertItemsEqual(new_attrs, ['users.username', 'users.desktop'])
    self.assertItemsEqual(conflicts, [('desktop', u'/home/blake/Desktop', u'/home/blakey/Desktop')])
