Esempio n. 1
0
    def test_delete_must_skip_resource_not_present(self):
        id = "SomeResource"
        template = SamTemplate(self.template_dict)

        self.assertIsNone(template.get(id))
        template.delete(id)
        self.assertIsNone(template.get(id))
    def test_delete_must_skip_resource_not_present(self):
        id = "SomeResource"
        template = SamTemplate(self.template_dict)

        self.assertIsNone(template.get(id))
        template.delete(id)
        self.assertIsNone(template.get(id))
Esempio n. 3
0
    def test_delete_must_delete_resource(self):
        id = "Function1"
        template = SamTemplate(self.template_dict)

        # Check if it exists
        self.assertIsNotNone(template.get(id))
        # Delete
        template.delete(id)
        # Check that it does not exist
        self.assertIsNone(template.get(id))
    def test_delete_must_delete_resource(self):
        id = "Function1"
        template = SamTemplate(self.template_dict)

        # Check if it exists
        self.assertIsNotNone(template.get(id))
        # Delete
        template.delete(id)
        # Check that it does not exist
        self.assertIsNone(template.get(id))
Esempio n. 5
0
    def test_get_must_return_resource(self):
        expected = {
            "Type": "AWS::Serverless::Function",
            "DependsOn": "SomeOtherResource",
            "Properties": {}
        }

        template = SamTemplate(self.template_dict)

        actual = template.get("Function1")
        self.assertIsNotNone(actual)
        self.assertTrue(isinstance(actual, SamResource))
        self.assertEquals(actual.to_dict(), expected)
    def test_get_must_return_resource(self):
        expected = {
            "Type": "AWS::Serverless::Function",
             "DependsOn": "SomeOtherResource",
            "Properties": {}
         }

        template = SamTemplate(self.template_dict)

        actual = template.get("Function1")
        self.assertIsNotNone(actual)
        self.assertTrue(isinstance(actual, SamResource))
        self.assertEqual(actual.to_dict(), expected)
Esempio n. 7
0
    def test_get_must_return_none_for_unknown_resource(self):
        template = SamTemplate(self.template_dict)

        actual = template.get("Something")
        self.assertIsNone(actual)
    def test_get_must_return_none_for_unknown_resource(self):
        template = SamTemplate(self.template_dict)

        actual = template.get("Something")
        self.assertIsNone(actual)