예제 #1
0
    def test_valid_values_files(self):
        """Ensures that values can be read and validated correctly from files on disk"""
        twine = Twine(source=VALID_SCHEMA_TWINE)

        with TemporaryDirectory() as tmp_dir:
            valid_configuration_file = self._write_json_string_to_file(self.VALID_CONFIGURATION_VALUE, tmp_dir)
            twine.validate_configuration_values(source=valid_configuration_file)
            twine.validate_input_values(source="""{"height": 40}""")
            twine.validate_output_values(source="""{"width": 36}""")
예제 #2
0
    def test_missing_values_files(self):
        """Ensures that if you try to read values from missing files, the right exceptions get raised"""
        twine = Twine(source=VALID_SCHEMA_TWINE)
        values_file = os.path.join(self.path, "not_a_file.json")

        with self.assertRaises(exceptions.ConfigurationValuesFileNotFound):
            twine.validate_configuration_values(source=values_file)

        with self.assertRaises(exceptions.InputValuesFileNotFound):
            twine.validate_input_values(source=values_file)

        with self.assertRaises(exceptions.OutputValuesFileNotFound):
            twine.validate_output_values(source=values_file)