Beispiel #1
0
    def should_prefer_command_over_abs(self):
        valid_trigger["relative"] = False
        Query.override_trigger_setting("filepath_type", "relative")

        Query.build("/absolute", valid_trigger, "current_folder")

        self.assert_equal(Query.get_base_path(), "current_folder")
Beispiel #2
0
    def should_transform_abs_to_rel_query(self):
        Query.override_trigger_setting("filepath_type",
                                       "relative")  # set query to be relative
        Query.build("/folder/sub", valid_trigger,
                    "current_folder")  # but insert absolute path

        self.assert_equal(Query.get_needle(), "folder/sub")
        self.assert_equal(Query.get_base_path(), "current_folder")
Beispiel #3
0
    def should_set_base_path_for_relative_queries(self):
        valid_trigger["relative"] = True
        # !Potential problem: path requires a trailing slash (os.path.dirname)
        valid_trigger["base_path"] = "base_path/"

        Query.build("", valid_trigger, "current_folder")

        self.assert_equal(Query.get_base_path(), "base_path")
Beispiel #4
0
    def should_prefer_needletype_over_relative_setting_02(self):
        valid_trigger["relative"] = False

        Query.build("../relative", valid_trigger, "current_folder")

        self.assert_equal(Query.get_base_path(), "current_folder")
Beispiel #5
0
    def should_not_set_basepath_for_absolute_queries(self):
        valid_trigger["relative"] = False

        Query.build("", valid_trigger, "current_folder")

        self.assert_equal(Query.get_base_path(), False)
Beispiel #6
0
    def should_set_basepath_to_current_folder(self):
        valid_trigger["relative"] = True

        Query.build("", valid_trigger, "current_folder")

        self.assert_equal(Query.get_base_path(), "current_folder")
Beispiel #7
0
    def should_not_set_basepath_for_absolute_queries(self):
        Query.reset()
        Query.build("", {"relative": False, "auto": True}, "current_folder")

        self.assert_equal(Query.get_base_path(), False)
Beispiel #8
0
    def should_set_basepath_to_current_folder(self):
        Query.reset()
        Query.build("", {"relative": True, "auto": True}, "current_folder")

        self.assert_equal(Query.get_base_path(), "current_folder")