class TestPaths(unittest.TestCase):
    cur_dir = abspath(split(sys.argv[0])[0])
    paths_list = [cur_dir, split(cur_dir)[0], split(split(cur_dir)[0])[0]]

    def setUp(self):
        self.path = Paths()
        cur_dir = self.paths_list.pop(0)
        print "Testing Paths from inside %s" % cur_dir
        self.path.set_umit_conf(cur_dir)

    def tearDown(self):
        del self.path

    def get_paths(self):
        self.assert_(exists(self.path.locale_dir),
                     "Failed to get 'locale_dir'")
        self.assert_(exists(self.path.pixmaps_dir),
                     "Failed to get 'pixmaps_dir'")
        self.assert_(exists(self.path.config_dir),
                     "Failed to get 'config_dir'")

        self.assert_(exists(self.path.config_file),
                     "Failed to get 'config_file'")
        self.assert_(exists(self.path.target_list),
                     "Failed to get 'target_list'")
        self.assert_(exists(self.path.profile_editor),
                     "Failed to get 'profile_editor'")
        self.assert_(exists(self.path.wizard), "Failed to get 'wizard'")
        self.assert_(exists(self.path.scan_profile),
                     "Failed to get 'scan_profile'")
        self.assert_(exists(self.path.recent_scans),
                     "Failed to get 'recent_scans'")
        self.assert_(exists(self.path.options), "Failed to get 'options'")

        self.assert_(exists(self.path.umit_op), "Failed to get 'umit_op'")
        self.assert_(exists(self.path.umit_opi), "Failed to get 'umit_opi'")
        self.assert_(exists(self.path.umit_opt), "Failed to get 'umit_opt'")
        self.assert_(exists(self.path.umit_opf), "Failed to get 'umit_opf'")
        self.assert_(exists(self.path.umitdb), "Failed to get 'umitdb'")
        self.assert_(exists(self.path.services_dump),
                     "Failed to get 'services_dump'")
        self.assert_(exists(self.path.os_dump), "Failed tp get 'os_dump'")
        self.assert_(exists(self.path.umit_version),
                     "Failed tp get 'umit_version'")
        self.assert_(exists(self.path.os_classification),
                     "Failed to get 'os_classification'")

        self.path.nmap_command_path

    def testConfigPaths1(self):
        self.get_paths()

    def testConfigPaths2(self):
        self.get_paths()

    def testConfigPaths3(self):
        self.get_paths()
 def __getattr__(self, name):
     if self.config_file_set:
         try:
             attr = Paths.__getattr__(self, name)
             return attr
         except NameError, e:
             if name in self.web_settings:
                 return self.config_parser.get(self.web_section, re.sub(r"^web_", "", name))
             else:
                 raise e
Exemple #3
0
 def __getattr__(self, name):
     if self.config_file_set:
         try:
             attr = Paths.__getattr__(self, name)
             return attr
         except NameError, e:
             if name in self.web_settings:
                 return self.config_parser.get(self.web_section,
                                               re.sub(r"^web_", "", name))
             else:
                 raise e
 def setUp(self):
     self.path = Paths()
     cur_dir = self.paths_list.pop(0)
     print "Testing Paths from inside %s" % cur_dir
     self.path.set_umit_conf(cur_dir)
 def set_umit_conf(self, base_dir):
     Paths.set_umit_conf(self, base_dir)
     Path.set_umit_conf(base_dir)
     if not exists(join(self.config_dir, "security.xml")) or not exists(join(self.config_dir, "umitweb.conf")):
         create_web_files(self.config_file, HOME)
 def setUp(self):
     self.path = Paths()
     cur_dir = self.paths_list.pop(0)
     print "Testing Paths from inside %s" % cur_dir
     self.path.set_umit_conf(cur_dir)
class TestPaths(unittest.TestCase):
    cur_dir = abspath(split(sys.argv[0])[0])
    paths_list = [cur_dir,
                  split(cur_dir)[0],
                  split(split(cur_dir)[0])[0]]

    def setUp(self):
        self.path = Paths()
        cur_dir = self.paths_list.pop(0)
        print "Testing Paths from inside %s" % cur_dir
        self.path.set_umit_conf(cur_dir)

    def tearDown(self):
        del self.path

    def get_paths(self):
        self.assert_(exists(self.path.locale_dir),
                     "Failed to get 'locale_dir'")
        self.assert_(exists(self.path.pixmaps_dir),
                     "Failed to get 'pixmaps_dir'")
        self.assert_(exists(self.path.config_dir),
                     "Failed to get 'config_dir'")

        self.assert_(exists(self.path.config_file),
                     "Failed to get 'config_file'")
        self.assert_(exists(self.path.target_list),
                     "Failed to get 'target_list'")
        self.assert_(exists(self.path.profile_editor),
                     "Failed to get 'profile_editor'")
        self.assert_(exists(self.path.wizard),
                     "Failed to get 'wizard'")
        self.assert_(exists(self.path.scan_profile),
                     "Failed to get 'scan_profile'")
        self.assert_(exists(self.path.recent_scans),
                     "Failed to get 'recent_scans'")
        self.assert_(exists(self.path.options),
                     "Failed to get 'options'")

        self.assert_(exists(self.path.umit_op),
                     "Failed to get 'umit_op'")
        self.assert_(exists(self.path.umit_opi),
                     "Failed to get 'umit_opi'")
        self.assert_(exists(self.path.umit_opt),
                     "Failed to get 'umit_opt'")
        self.assert_(exists(self.path.umit_opf),
                     "Failed to get 'umit_opf'")
        self.assert_(exists(self.path.umitdb),
                     "Failed to get 'umitdb'")
        self.assert_(exists(self.path.services_dump),
                     "Failed to get 'services_dump'")
        self.assert_(exists(self.path.os_dump),
                     "Failed tp get 'os_dump'")
        self.assert_(exists(self.path.umit_version),
                     "Failed tp get 'umit_version'")
        self.assert_(exists(self.path.os_classification),
                     "Failed to get 'os_classification'")

        self.path.nmap_command_path

    def testConfigPaths1(self):
        self.get_paths()

    def testConfigPaths2(self):
        self.get_paths()

    def testConfigPaths3(self):
        self.get_paths()
Exemple #8
0
 def set_umit_conf(self, base_dir):
     Paths.set_umit_conf(self, base_dir)
     Path.set_umit_conf(base_dir)
     if not exists(join(self.config_dir, "security.xml")) or \
        not exists(join(self.config_dir, "umitweb.conf")):
         create_web_files(self.config_file, HOME)