'Check we can retrieve a Linux kb.'

def testKnowledgeBaseRetrievalLinuxPasswd(self):

    self.ClearKB()
    with vfs_test_lib.VFSOverrider(rdf_paths.PathSpec.PathType.OS, vfs_test_lib.FakeTestDataVFSHandler):
        with test_lib.ConfigOverrider({'Artifacts.knowledge_base': ['LinuxWtmp', 'LinuxPasswdHomedirs', 'LinuxRelease'], 'Artifacts.knowledge_base_additions': [], 'Artifacts.knowledge_base_skip': []}):
            for _ in flow_test_lib.TestFlowHelper(artifact.KnowledgeBaseInitializationFlow.__name__, self.client_mock, client_id=self.client_id, token=self.token):
                pass
            client = aff4.FACTORY.Open(self.client_id, token=self.token, mode='rw')
            kb = artifact.GetArtifactKnowledgeBase(client)
            self.assertEqual(kb.os_major_version, 14)
            self.assertEqual(kb.os_minor_version, 4)
            self.assertItemsEqual([x.username for x in kb.users], ['user1', 'user2', 'user3'])
            user = kb.GetUser(username='user1')
            self.assertEqual(user.last_logon.AsSecondsFromEpoch(), 1296552099)
            self.assertEqual(user.homedir, '/home/user1')
            user = kb.GetUser(username='user2')
            self.assertEqual(user.last_logon.AsSecondsFromEpoch(), 1296552102)
            self.assertEqual(user.homedir, '/home/user2')
            self.assertFalse(kb.GetUser(username='buguser3'))
