def test_iterate_must_yield_sam_resources_only(self):
        template = SamTemplate(self.template_dict)

        expected = [
            ("Function1", {
                "Type": "AWS::Serverless::Function",
                "DependsOn": "SomeOtherResource",
                "Properties": {}
            }),
            ("Function2", {
                "Type": "AWS::Serverless::Function",
                "a": "b",
                "Properties": {}
            }),
            ("Api", {
                "Type": "AWS::Serverless::Api",
                "Properties": {}
            }),
            ("Layer", {
                "Type": "AWS::Serverless::LayerVersion",
                "Properties": {}
            }),
        ]

        actual = [(id, resource.to_dict())
                  for id, resource in template.iterate()]
        assertCountEqual(self, expected, actual)
예제 #2
0
    def test_iterate_must_filter_with_resource_not_found(self):
        template = SamTemplate(self.template_dict)

        type = "AWS::Serverless::SimpleTable"
        expected = []

        actual = [(id, resource.to_dict()) for id, resource in template.iterate(type)]
        self.assertEquals(expected, actual)
예제 #3
0
    def test_iterate_must_not_return_non_sam_resources_with_filter(self):
        template = SamTemplate(self.template_dict)

        type = "AWS::Lambda::Function"
        expected = []

        actual = [(id, resource.to_dict()) for id, resource in template.iterate(type)]
        self.assertEquals(expected, actual)
    def test_iterate_must_filter_with_resource_not_found(self):
        template = SamTemplate(self.template_dict)

        type = "AWS::Serverless::SimpleTable"
        expected = []

        actual = [(id, resource.to_dict()) for id, resource in template.iterate(type)]
        self.assertEqual(expected, actual)
    def test_iterate_must_not_return_non_sam_resources_with_filter(self):
        template = SamTemplate(self.template_dict)

        type = "AWS::Lambda::Function"
        expected = []

        actual = [(id, resource.to_dict()) for id, resource in template.iterate(type)]
        self.assertEqual(expected, actual)
예제 #6
0
    def test_iterate_must_filter_by_layers_resource_type(self):
        template = SamTemplate(self.template_dict)

        type = "AWS::Serverless::LayerVersion"
        expected = [
            ("Layer", {"Type": "AWS::Serverless::LayerVersion", "Properties": {}}),
        ]

        actual = [(id, resource.to_dict()) for id, resource in template.iterate(type)]
        self.assertEquals(expected, actual)
    def test_iterate_must_filter_by_layers_resource_type(self):
        template = SamTemplate(self.template_dict)

        type = "AWS::Serverless::LayerVersion"
        expected = [
            ("Layer", {"Type": "AWS::Serverless::LayerVersion", "Properties": {}}),
        ]

        actual = [(id, resource.to_dict()) for id, resource in template.iterate(type)]
        self.assertEqual(expected, actual)
예제 #8
0
    def test_iterate_must_filter_by_resource_type(self):

        template = SamTemplate(self.template_dict)

        type = "AWS::Serverless::Function"
        expected = [
            ("Function1", {"Type": "AWS::Serverless::Function", "DependsOn": "SomeOtherResource", "Properties": {}}),
            ("Function2", {"Type": "AWS::Serverless::Function", "a": "b", "Properties": {}}),
        ]

        actual = [(id, resource.to_dict()) for id, resource in template.iterate(type)]
        self.assertEquals(expected, actual)
    def test_iterate_must_filter_by_resource_type(self):

        template = SamTemplate(self.template_dict)

        type = "AWS::Serverless::Function"
        expected = [
            ("Function1", {"Type": "AWS::Serverless::Function", "DependsOn": "SomeOtherResource", "Properties": {}}),
            ("Function2", {"Type": "AWS::Serverless::Function", "a": "b", "Properties": {}}),
        ]

        actual = [(id, resource.to_dict()) for id, resource in template.iterate(type)]
        self.assertEqual(expected, actual)
    def test_iterate_must_yield_sam_resources_only(self):
        template = SamTemplate(self.template_dict)

        expected = [
            ("Function1", {"Type": "AWS::Serverless::Function", "DependsOn": "SomeOtherResource", "Properties": {}}),
            ("Function2", {"Type": "AWS::Serverless::Function", "a": "b", "Properties": {}}),
            ("Api", {"Type": "AWS::Serverless::Api", "Properties": {}}),
            ("Layer", {"Type": "AWS::Serverless::LayerVersion", "Properties": {}}),
        ]

        actual = [(id, resource.to_dict()) for id, resource in template.iterate()]
        assertCountEqual(self, expected, actual)