Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)