grr/core/grr_response_core/lib/parsers/linux_cmd_parser_test.py
def testYumRepolistCmdParser(self):
    """Test to see if we can get data from yum repolist output."""
    parser = linux_cmd_parser.YumRepolistCmdParser()
    content = open(os.path.join(self.base_path, "repolist.out"), "rb").read()
    repolist = list(
        parser.Parse("/usr/bin/yum", ["repolist", "-v", "-q"], content, "", 0,
                     5, None))
    self.assertIsInstance(repolist[0], rdf_client.PackageRepository)

    self.assertEqual(repolist[0].id, "rhel")
    self.assertEqual(repolist[0].name, "rhel repo")
    self.assertEqual(repolist[0].revision, "1")
    self.assertEqual(repolist[0].last_update, "Sun Mar 15 08:51:32")
    self.assertEqual(repolist[0].num_packages, "12")
    self.assertEqual(repolist[0].size, "8 GB")
    self.assertEqual(repolist[0].baseurl, "http://rhel/repo")
    self.assertEqual(repolist[0].timeout,
                     "1200 second(s) (last: Mon Apr  1 20:30:02 2016)")
    self.assertLen(repolist, 2)
Test to see if we can get data from yum repolist output.
Test to see if we can get data from yum repolist output.
Test to see if we can get data from yum repolist output .
def testYumRepolistCmdParser(self):
    parser = linux_cmd_parser.YumRepolistCmdParser()
    content = open(os.path.join(self.base_path, "repolist.out"), "rb").read()
    repolist = list(
        parser.Parse("/usr/bin/yum", ["repolist", "-v", "-q"], content, "", 0,
                     5, None))
    self.assertIsInstance(repolist[0], rdf_client.PackageRepository)
    self.assertEqual(repolist[0].id, "rhel")
    self.assertEqual(repolist[0].name, "rhel repo")
    self.assertEqual(repolist[0].revision, "1")
    self.assertEqual(repolist[0].last_update, "Sun Mar 15 08:51:32")
    self.assertEqual(repolist[0].num_packages, "12")
    self.assertEqual(repolist[0].size, "8 GB")
    self.assertEqual(repolist[0].baseurl, "http://rhel/repo")
    self.assertEqual(repolist[0].timeout,
                     "1200 second(s) (last: Mon Apr  1 20:30:02 2016)")
    self.assertLen(repolist, 2)
def testYumRepolistCmdParser ( self ) : parser = linux_cmd_parser . YumRepolistCmdParser ( ) content = open ( os . path . join ( self . base_path , "repolist.out" ) , "rb" ) . read ( ) repolist = list ( parser . Parse ( "/usr/bin/yum" , [ "repolist" , "-v" , "-q" ] , content , "" , 0 , 5 , None ) ) self . assertIsInstance ( repolist [ 0 ] , rdf_client . PackageRepository ) self . assertEqual ( repolist [ 0 ] . id , "rhel" ) self . assertEqual ( repolist [ 0 ] . name , "rhel repo" ) self . assertEqual ( repolist [ 0 ] . revision , "1" ) self . assertEqual ( repolist [ 0 ] . last_update , "Sun Mar 15 08:51:32" ) self . assertEqual ( repolist [ 0 ] . num_packages , "12" ) self . assertEqual ( repolist [ 0 ] . size , "8 GB" ) self . assertEqual ( repolist [ 0 ] . baseurl , "http://rhel/repo" ) self . assertEqual ( repolist [ 0 ] . timeout , "1200 second(s) (last: Mon Apr  1 20:30:02 2016)" ) self . assertLen ( repolist , 2 )
Test to see if we can get data from yum repolist output.
Test to see if we can get data from yum repolist output .
"""Test to see if we can get data from yum repolist output."""
self