def testCompareText1(self): option_parser = UmitOptionParser(["-e", "file1.usr", "file2.usr"]) self.assert_(option_parser.get_compare_text() == ("file1.usr", "file2.usr"), "Failed to get text compare option (-e file1.usr file2.usr)")
def testDiff1(self): option_parser = UmitOptionParser(["-d", "file1.usr", "file2.usr"]) self.assert_(option_parser.get_diff() == ("file1.usr", "file2.usr"), "Failed to get diff option (-d file1.usr file2.usr)")
def testCompare2(self): option_parser = UmitOptionParser(["--compare", "file1.usr", "file2.usr"]) self.assert_(option_parser.get_compare() == ("file1.usr", "file2.usr"), "Failed to get compare option \ (--compare file1.usr file2.usr)")
def testNmap4(self): option_parser = UmitOptionParser(["--nmap", "-T4", "-P0", "192.168.0.*"]) # Shoudl return False, because no nmap arg was defined self.assert_(option_parser.get_nmap() == ["-T4", "-P0", "192.168.0.*"], "Failed to get nmap option (--nmap -T4 -P0 192.168.0.*)")
def testOpenScanResult4(self): option_parser = UmitOptionParser(["--file=file1.xml", "--file=file2.usr", "file3.xml"]) self.assert_(option_parser.get_open_results() == \ ["file1.xml", "file2.usr", "file3.xml"], "Failed to get files (--file=file1.xml \ --file=file2.usr file3.xml)")
def testVerbose1(self): option_parser = UmitOptionParser([""]) self.assert_(option_parser.get_verbose() == 40, "Failed to get verbose")
def testProfile2(self): option_parser = UmitOptionParser(["--profile=profile_name"]) self.assert_(option_parser.get_profile() == "profile_name", "Failed to get profile option (--profile=profile_name)")
def testNmap3(self): option_parser = UmitOptionParser(["--nmap"]) # Shoudl return False, because no nmap arg was defined self.assert_(not option_parser.get_nmap(), "Failed to get nmap option (--nmap)")
def testInventory4(self): option_parser = UmitOptionParser(["--inventory", "inventory_name"]) self.assert_(option_parser.get_inventory() == "inventory_name", "Failed to get inventory option (--inventory inventory_name)")
def testInventory2(self): option_parser = UmitOptionParser(["--inventory"]) self.assert_(option_parser.get_inventory(), "Failed to get inventory option (--inventory)")
def testVerbose5(self): option_parser = UmitOptionParser(["-v", "-v", "-v", "-v"]) self.assert_(option_parser.get_verbose() == 0, "Failed to get verbose (-v -v -v -v)")
def testNSEFacilitator3(self): option_parser = UmitOptionParser(["--nse-facilitator"]) self.assert_(option_parser.get_nse_facilitator() == ["default"], "Failed to get nse-facilitator option (--nse-facilitator)")
def testOpenMapper2(self): option_parser = UmitOptionParser(["--mapper=file1.usr"]) self.assert_(option_parser.get_mapper() == "file1.usr", "Failed to get mapper option (--mapper=file1.usr)")
def testOpenScanResult2(self): option_parser = UmitOptionParser(["-f", "file1.xml", "-f", "file2.usr"]) self.assert_(option_parser.get_open_results() == \ ["file1.xml", "file2.usr"], "Failed to get files (-f file1.xml -f file2.usr)")
def testNmapProtocol(self): option_parser = UmitOptionParser(["nmap://profile_name/target"]) self.assert_(option_parser.get_protocol() == \ "nmap://profile_name/target", "Failed to get protocol argument (nmap://profile_name/target)")
def testTarget2(self): option_parser = UmitOptionParser(["--target=www.microsoft.com"]) self.assert_(option_parser.get_target() == "www.microsoft.com", "Failed to get target option (--target=www.microsoft.com)")
def testNSEFacilitator4(self): option_parser = UmitOptionParser(["--nse-facilitator", "script1.nse"]) self.assert_(option_parser.get_nse_facilitator() == ["script1.nse"], "Failed to get nse-facilitator option \ (--nse-facilitator script1.nse)")