Beispiel #1
0
    def check_validation(self, test):
        """
        Check that validate inputs runs without errors, and that there
        are no validation issues recorded in the status_validation table
        :return:
        """

        # Check that test validation runs without errors
        validate_inputs.main(
            ["--database", DB_PATH,
             "--scenario", test,
             "--quiet"]
        )

        # Check that no validation issues are recorded in the db for the test
        expected_validations = []

        conn = connect_to_database(db_path=DB_PATH,
                                   detect_types=sqlite3.PARSE_DECLTYPES)
        c = conn.cursor()
        validations = c.execute(
            """
            SELECT scenario_name FROM status_validation
            INNER JOIN
            (SELECT scenario_id, scenario_name FROM scenarios)
            USING (scenario_id)
            WHERE scenario_name = '{}'
            """.format(test)
        )
        actual_validations = validations.fetchall()

        self.assertListEqual(expected_validations, actual_validations)
def validate_scenario(db_path, client_message):
    """

    :param db_path:
    :param client_message:
    :return:
    """
    scenario_id = str(client_message["scenario"])
    validate_inputs.main(["--database", db_path, "--scenario_id", scenario_id])