def test_flip_with_bad_data(self): """ Test that flip fails with an error message when passed bad data """ with self.assertRaisesRegexp(Exception, self.fail_message): cfn_flip.flip(self.bad_data)
def test_flip_to_json(self): """ Test that flip performs correctly transforming from yaml to json """ actual = cfn_flip.flip(self.input_yaml) parsed_actual = json.loads(actual) self.assertDictEqual(parsed_actual, self.parsed_json)
def test_flip_to_clean_json(self): """ Test that flip performs correctly transforming from yaml to json and the `clean_up` flag is active """ actual = cfn_flip.flip(self.input_yaml, clean_up=True) parsed_actual = json.loads(actual) self.assertDictEqual(parsed_actual, self.parsed_clean_json)
def test_flip_to_yaml(self): """ Test that flip performs correctly transforming from json to yaml """ actual = cfn_flip.flip(self.input_json) # The result should not parse as json with self.assertRaises(ValueError): json.loads(actual) parsed_actual = custom_yaml.load(actual) self.assertDictEqual(parsed_actual, self.parsed_yaml)