示例#1
0
    def test_cpe(self):
        apa = CPE(self.cpelist[0])

        self.assertTrue(apa.is_application())
        self.assertFalse(apa.is_hardware())
        self.assertFalse(apa.is_operating_system())
        self.assertEqual(
            apa.cpedict,
            {
                "cpe": "cpe",
                "edition": "",
                "language": "",
                "part": "/a",
                "product": "http_server",
                "update": "",
                "vendor": "apache",
                "version": "2.2.22",
            },
        )

        win = CPE(self.cpelist[12])
        self.assertEqual(win.get_vendor(), "microsoft")
        self.assertEqual(win.get_product(), "windows_server_2008")
        self.assertEqual(win.get_version(), "")
        self.assertEqual(win.get_update(), "beta3")
        self.assertEqual(win.get_edition(), "")
        self.assertEqual(win.get_language(), "")
示例#2
0
 def test_full_cpe(self):
     cpestr = 'cpe:/a:mozilla:firefox:2.0::osx:es-es'
     resdict = { 'part':'/a', 'vendor':"mozilla", 'product':"firefox", 'version':"2.0", 'update':'', 'edition':"osx", 'language':'es-es' }
     ocpe = CPE(cpestr)
     objdict = {'part': ocpe.get_part(),
                'vendor': ocpe.get_vendor(),
                'product': ocpe.get_product(),
                'version': ocpe.get_version(),
                'update': ocpe.get_update(),
                'language': ocpe.get_language(),
                'edition': ocpe.get_edition()
     }
     self.assertEqual(objdict, resdict)
 def test_full_cpe(self):
     cpestr = 'cpe:/a:mozilla:firefox:2.0::osx:es-es'
     resdict = { 'part':'/a', 'vendor':"mozilla", 'product':"firefox", 'version':"2.0", 'update':'', 'edition':"osx", 'language':'es-es' }
     ocpe = CPE(cpestr)
     objdict = {'part': ocpe.get_part(),
                'vendor': ocpe.get_vendor(),
                'product': ocpe.get_product(),
                'version': ocpe.get_version(),
                'update': ocpe.get_update(),
                'language': ocpe.get_language(),
                'edition': ocpe.get_edition()
     }
     self.assertEqual(objdict, resdict)
示例#4
0
    def test_cpe(self):
        apa = CPE(self.cpelist[0])

        self.assertTrue(apa.is_application())
        self.assertFalse(apa.is_hardware())
        self.assertFalse(apa.is_operating_system())

        win = CPE(self.cpelist[12])
        self.assertEqual(win.get_vendor(), 'microsoft')
        self.assertEqual(win.get_product(), 'windows_server_2008')
        self.assertEqual(win.get_version(), '')
        self.assertEqual(win.get_update(), 'beta3')
        self.assertEqual(win.get_edition(), '')
        self.assertEqual(win.get_language(), '')
示例#5
0
    def test_cpe(self):
        apa = CPE(self.cpelist[0])

        self.assertTrue(apa.is_application())
        self.assertFalse(apa.is_hardware())
        self.assertFalse(apa.is_operating_system())
   

        win = CPE(self.cpelist[12])
        self.assertEqual(win.get_vendor(), 'microsoft')
        self.assertEqual(win.get_product(), 'windows_server_2008')
        self.assertEqual(win.get_version(), '')
        self.assertEqual(win.get_update(), 'beta3')
        self.assertEqual(win.get_edition(), '')
        self.assertEqual(win.get_language(), '')
示例#6
0
 def test_full_cpe(self):
     cpestr = "cpe:/a:mozilla:firefox:2.0::osx:es-es"
     resdict = {
         "part": "/a",
         "vendor": "mozilla",
         "product": "firefox",
         "version": "2.0",
         "update": "",
         "edition": "osx",
         "language": "es-es",
     }
     ocpe = CPE(cpestr)
     objdict = {
         "part": ocpe.get_part(),
         "vendor": ocpe.get_vendor(),
         "product": ocpe.get_product(),
         "version": ocpe.get_version(),
         "update": ocpe.get_update(),
         "language": ocpe.get_language(),
         "edition": ocpe.get_edition(),
     }
     self.assertEqual(objdict, resdict)
     # self.assertEqual(ocpe.cpedict, resdict)
     self.assertEqual(str(ocpe), cpestr)