def test_json_file_has_correct_properties(self):
        with self.assertRaises(KeyError):
            bad_property_template = Template(self.test_json_files["bad_property_json_file"])
            bad_property_template.read()

        with self.assertRaises(ValueError):
            missing_property_template = Template(self.test_json_files["missing_property_json_file"])
            missing_property_template.read()

        valid_template = Template(self.test_json_files["valid_json_file"])
        valid_template.read()

        for json_template_property in self.json_template_properties:
            self.assertIsNotNone(valid_template.__dict__[json_template_property])
    def test_valid_json_format(self):
        with self.assertRaises(ValueError):
            blank_template = Template(self.test_json_files["blank_json_file"])
            blank_template.read()

        with self.assertRaises(ValueError):
            invalid_template = Template(self.test_json_files["invalid_json_file"])
            invalid_template.read()

        try:
            valid_template = Template(self.test_json_files["valid_json_file"])
            valid_template.read()
        except ValueError:
            self.fail("valid_json_file not valid JSON")
    def test_json_file_exists(self):
        with self.assertRaises(IOError):
            missing_template = Template(
                self.test_json_files["missing_json_file"])
            missing_template.read()

        try:
            valid_template = Template(self.test_json_files["valid_json_file"])
            valid_template.read()
        except IOError:
            self.fail("valid_json_file not found: %s" %
                      self.test_json_files["valid_json_file"])
    def test_json_file_exists(self):
        with self.assertRaises(IOError):
            missing_template = Template(self.test_json_files["missing_json_file"])
            missing_template.read()

        try:
            valid_template = Template(self.test_json_files["valid_json_file"])
            valid_template.read()
        except IOError:
            self.fail("valid_json_file not found: %s" % self.test_json_files["valid_json_file"])
    def test_for_correct_values(self):
        valid_template = Template(self.test_json_files["valid_json_file"])
        valid_template.read()

        for key, value in self.json_values.iteritems():
            self.assertEqual(valid_template.__dict__[key], value)
    def test_json_file_has_correct_properties(self):
        with self.assertRaises(KeyError):
            bad_property_template = Template(
                self.test_json_files["bad_property_json_file"])
            bad_property_template.read()

        with self.assertRaises(ValueError):
            missing_property_template = Template(
                self.test_json_files["missing_property_json_file"])
            missing_property_template.read()

        valid_template = Template(self.test_json_files["valid_json_file"])
        valid_template.read()

        for json_template_property in self.json_template_properties:
            self.assertIsNotNone(
                valid_template.__dict__[json_template_property])
    def test_valid_json_format(self):
        with self.assertRaises(ValueError):
            blank_template = Template(self.test_json_files["blank_json_file"])
            blank_template.read()

        with self.assertRaises(ValueError):
            invalid_template = Template(
                self.test_json_files["invalid_json_file"])
            invalid_template.read()

        try:
            valid_template = Template(self.test_json_files["valid_json_file"])
            valid_template.read()
        except ValueError:
            self.fail("valid_json_file not valid JSON")
    def test_for_correct_values(self):
        valid_template = Template(self.test_json_files["valid_json_file"])
        valid_template.read()

        for key, value in self.json_values.iteritems():
            self.assertEqual(valid_template.__dict__[key], value)