示例#1
0
class SednaConfigPathTest(TestCase):
    """
    The test cases to check SednaConfigPath can get right
    absolute path of sedna.conf or user-defined path.
    """
    def setUp(self):
        self.path = SednaConfigPath()

    def test_get_default_config_path(self):
        """
        The test case to check SednaConfigPath.test_get_default_config_path
        can get the right default path of sedna.conf.
        """
        config_path_default = self.path.get_config_path()

        tests_absolute_path_list = os.getcwd().split("/")
        absolute_repository_path_list = []
        absolute_fixed_path_list = ""
        for i in tests_absolute_path_list:
            absolute_repository_path_list.append(i)
            if i == "sedna":
                absolute_fixed_path_list =\
                    "/".join(absolute_repository_path_list) + "/sedna.conf"
                break

        self.assertEquals(
            config_path_default, absolute_fixed_path_list,
            "SednaConfigPath cannnot get the right fixed path of sedna.conf.")

    def test_get_defined_config_path(self):
        """
        The test case to check SednaConfigPath.get_defined_config_path can
        change the user-defined relative path to its right absolut path.
        """
        config_path_defined =\
            self.path.get_config_path("./tests/test_common.py")

        tests_absolute_path_list = os.getcwd().split("/")
        absolute_repository_path_list = []
        absolute_defined_path_list = ""
        for i in tests_absolute_path_list:
            absolute_repository_path_list.append(i)
            if i == "sedna":
                absolute_defined_path_list =\
                    "/".join(absolute_repository_path_list)\
                    + "/tests/test_common.py"
                break

        self.assertEquals(
            config_path_defined, absolute_defined_path_list,
            "SednaConfigPath cannnot change the user-defined \
            relative path to its right absolut path")

    def tearDown(self):
        pass
示例#2
0
def main():
    sedna_config_path = SednaConfigPath()
    config_dir = sedna_config_path.get_config_path()
    config = Config(config_dir)
    sedna_config_value = config.get_sedna_config()
    master = Master()
    results = master.verify_nodes(sedna_config_value)
    formated_result = FormatedResult()
    formated_result.format_output_log(results)
示例#3
0
    def setUp(self):
        self.fake_config_file = FakeSednaConfigFile()
        fake_relative_path = self.fake_config_file.set_up_negtive()
        config = SednaConfigParser()
        self.fake_sedna_config = config.get_config_parser(fake_relative_path)

        fake_sedna_config_path = SednaConfigPath()
        self.absolute_fake_sedna_config_path =\
            fake_sedna_config_path.get_config_path("./tests/fake_sedna.conf")