Beispiel #1
0
 def setup_method(self, method):
     sys.argv.clear()
     sys.argv.append("spam")
     sys.argv.append("spam")
     cmd_parser = CommandArgumentParser()
     self._cmd_args = cmd_parser.parse()
     self._log_file = os.path.join(env.BASE_DIR, "logs", "app.log")
     runner = ScenarioRunner(self._cmd_args)
     runner.add_system_path()
Beispiel #2
0
    def test_execute_scenario_ok(self):
        test_data = {
            "scenario": [{
                "arguments": {
                    "src_dir": self._pj_dir,
                    "src_pattern": r"(.*)\.csv"
                },
                "class": "FileRename",
                "step": "",
            }]
        }
        with open(self._scenario_file, "w") as f:
            f.write(yaml.dump(test_data, default_flow_style=False))

        runner = ScenarioRunner(self._cmd_args)
        runner.execute_scenario()
Beispiel #3
0
    def test_create_scenario_queue_ok(self):
        os.makedirs(self._pj_dir)
        test_data = {
            "scenario": [{
                "arguments": {
                    "retry_count": 10
                },
                "class": "SftpFileExtract",
                "step": "sftp_file_extract",
            }]
        }

        with open(self._scenario_file, "w") as f:
            f.write(yaml.dump(test_data, default_flow_style=False))

        is_completed_queue_creation = True
        try:
            runner = ScenarioRunner(self._cmd_args)
            runner.create_scenario_queue()
        except Exception:
            is_completed_queue_creation = False
        else:
            shutil.rmtree(self._pj_dir)
        assert is_completed_queue_creation is True
Beispiel #4
0
 def test_add_system_path(self):
     runner = ScenarioRunner(self._cmd_args)
     runner.add_system_path()
     includes_spam = any("project/spam" in p for p in sys.path)
     assert includes_spam is True