import datetime

from six import string_types

from cfn_sphere.template import CloudFormationTemplate

try:
    from unittest2 import TestCase
    from mock import Mock
except ImportError:
    from unittest import TestCase
    from mock import Mock


class CloudFormationTemplateTests(TestCase):
    def test_get_template_body_dict_returns_template_format_value_as_string_if_date_given(self):
        template_dict = {
            'AWSTemplateFormatVersion': datetime.date(2010, 9, 9)
        }

        result = CloudFormationTemplate(template_dict, "Something").get_template_body_dict()
        template_version = result["AWSTemplateFormatVersion"]
        self.assertIsInstance(template_version, string_types)
        self.assertEqual(result["AWSTemplateFormatVersion"], "2010-09-09")

    def test_get_template_body_dict_returns_default_version_if_none_given(self):
        template_dict = {}

        result = CloudFormationTemplate(template_dict, "Something").get_template_body_dict()
        template_version = result["AWSTemplateFormatVersion"]
        self.assertIsInstance(template_version, string_types)
        self.assertEqual(result["AWSTemplateFormatVersion"], "2010-09-09")

@@ -1163,28 +1163,1086 @@
 matVersion%22%5D, %222010-09-09%22)%0A
+%0A    def test_get_no_echo_parameter_keys(self):%0A        template_dict = %7B%0A            'Parameters': %7B%0A                %22a%22: %7B%22Description%22: %22param a%22, %22Type%22: %22String%22, %22NoEcho%22: True%7D,%0A                %22b%22: %7B%22Description%22: %22param a%22, %22Type%22: %22String%22%7D,%0A                %22c%22: %7B%22Description%22: %22param a%22, %22Type%22: %22String%22%7D,%0A                %22d%22: %7B%22Description%22: %22param a%22, %22Type%22: %22String%22, %22NoEcho%22: %22true%22%7D,%0A                %22e%22: %7B%22Description%22: %22param a%22, %22Type%22: %22String%22, %22NoEcho%22: %22True%22%7D,%0A                %22f%22: %7B%22Description%22: %22param a%22, %22Type%22: %22String%22, %22NoEcho%22: None%7D,%0A                %22g%22: %7B%22Description%22: %22param a%22, %22Type%22: %22String%22, %22noecho%22: True%7D,%0A            %7D%0A        %7D%0A%0A        result = CloudFormationTemplate(template_dict, %22Something%22).get_no_echo_parameter_keys()%0A        self.assertEqual(result, %5B'a', 'd', 'e'%5D)%0A%0A    def test_get_no_echo_parameter_keys_for_empty_parameters(self):%0A        template_dict = %7B%7D%0A%0A        result = CloudFormationTemplate(template_dict, %22Something%22).get_no_echo_parameter_keys()%0A        self.assertEqual(result, %5B%5D)%0A

add some tests for noecho parameter lookup