def test_correct_module_set(self):
     '''
     Test to get right module directory with contents option,
     directory with modules are the same where all-xccdf file is located
     '''
     conf = {
         "contents": "tests/Modules/all-xccdf.xml",
     }
     dummy_conf = DummyConf(**conf)
     cli = CLI(["--contents", "tests/Modules/all-xccdf.xml"])
     app = Application(Conf(dummy_conf, settings, cli))
     # Prepare all variables for test
     app.conf.source_dir = os.getcwd()
     app.content = app.conf.contents
     app.basename = os.path.basename(app.content)
     app.determine_module_set_location()
     self.assertEqual(app.module_set_dirname, 'Modules')
    def test_wrong_content_scenario(self):
        """
        Basic test for whole program
        """
        conf = {
            "contents": "tests/FOOBAR6_7A/dummy_preupg/all-xccdf.xml",
            "profile": "xccdf_preupg_profile_default",
            "result_dir": self.temp_dir,
            "skip_common": True,
            "temp_dir": self.temp_dir,
            "id": None,
            "debug": True,  # so root check won't fail
        }

        dc = DummyConf(**conf)
        cli = CLI(["--contents", "tests/FOOBAR6_7A/dummy_preupg/all-xccdf.xml"])
        a = Application(Conf(dc, settings, cli))
        # Prepare all variables for test
        a.conf.source_dir = os.getcwd()
        a.content = a.conf.contents
        a.basename = os.path.basename(a.content)
        self.assertEqual(a.get_scenario(), None)
def setup_preupg_environment(args, content, tmp_dir, mode=None):
    conf = {
        "contents": content,
        "profile": "xccdf_preupg_profile_default",
        "assessment_results_dir": tmp_dir,
        "skip_common": True,
        "temp_dir": tmp_dir,
        "id": None,
        "debug": True,  # so root check won't fail
        "mode": mode,
    }
    dc = DummyConf(**conf)
    cli = CLI(args)
    a = Application(Conf(dc, settings, cli))
    # Prepare all variables for test
    a.conf.source_dir = os.getcwd()
    a.content = a.conf.contents
    a.basename = os.path.basename(a.content)
    a.openscap_helper = OpenSCAPHelper(
        a.conf.assessment_results_dir, a.conf.result_prefix, a.conf.xml_result_name, a.conf.html_result_name, a.content
    )
    return a
Пример #4
0
    def test_wrong_content_scenario(self):
        """
        Basic test for whole program
        """
        conf = {
            "contents": "tests/FOOBAR6_7A/dummy_preupg/all-xccdf.xml",
            "profile": "xccdf_preupg_profile_default",
            "result_dir": self.temp_dir,
            "skip_common": True,
            "temp_dir": self.temp_dir,
            "id": None,
            "debug": True,  # so root check won't fail
        }

        dc = DummyConf(**conf)
        cli = CLI(
            ["--contents", "tests/FOOBAR6_7A/dummy_preupg/all-xccdf.xml"])
        a = Application(Conf(dc, settings, cli))
        # Prepare all variables for test
        a.conf.source_dir = os.getcwd()
        a.content = a.conf.contents
        a.basename = os.path.basename(a.content)
        self.assertEqual(a.get_scenario(), None)
Пример #5
0
def setup_preupg_environment(args, content, tmp_dir, mode=None):
    conf = {
        "contents": content,
        "profile": "xccdf_preupg_profile_default",
        "assessment_results_dir": tmp_dir,
        "skip_common": True,
        "temp_dir": tmp_dir,
        "id": None,
        "debug": True,  # so root check won't fail
        "mode": mode,
    }
    dc = DummyConf(**conf)
    cli = CLI(args)
    a = Application(Conf(dc, settings, cli))
    # Prepare all variables for test
    a.conf.source_dir = os.getcwd()
    a.content = a.conf.contents
    a.basename = os.path.basename(a.content)
    a.openscap_helper = OpenSCAPHelper(a.conf.assessment_results_dir,
                                       a.conf.result_prefix,
                                       a.conf.xml_result_name,
                                       a.conf.html_result_name, a.content)
    return a