'Check we can retrieve a knowledge base from a client.'

def testKnowledgeBaseRetrievalWindows(self):

    self.ClearKB()
    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)
    kb = artifact.GetArtifactKnowledgeBase(client)
    self.assertEqual(kb.environ_systemroot, 'C:\\Windows')
    self.assertEqual(kb.time_zone, 'US/Alaska')
    self.assertEqual(kb.code_page, 'cp_1252')
    self.assertEqual(kb.environ_windir, 'C:\\Windows')
    self.assertEqual(kb.environ_allusersprofile, 'C:\\Users\\All    Users')
    self.assertEqual(kb.environ_allusersappdata, 'C:\\ProgramData')
    self.assertEqual(kb.environ_temp, 'C:\\Windows\\TEMP')
    self.assertEqual(kb.environ_systemdrive, 'C:')
    self.assertItemsEqual([x.username for x in kb.users], ['jim', 'kovacs'])
    user = kb.GetUser(username='jim')
    self.assertEqual(user.username, 'jim')
    self.assertEqual(user.sid, 'S-1-5-21-702227068-2140022151-3110739409-1000')
