def test_with_image_uri(self):
     function = SamFunction("foo")
     function.ImageUri = "123456789.dkr.ecr.us-east-1.amazonaws.com/myimage:latest"
     function.PackageType = IMAGE
     cfnResources = function.to_cloudformation(**self.kwargs)
     generatedFunctionList = [x for x in cfnResources if isinstance(x, LambdaFunction)]
     self.assertEqual(generatedFunctionList.__len__(), 1)
     self.assertEqual(generatedFunctionList[0].Code, {"ImageUri": function.ImageUri})
 def test_with_image_uri_layers_runtime_handler(self):
     function = SamFunction("foo")
     function.ImageUri = "123456789.dkr.ecr.us-east-1.amazonaws.com/myimage:latest"
     function.Layers = ["Layer1"]
     function.Runtime = "foo"
     function.Handler = "bar"
     function.PackageType = IMAGE
     with pytest.raises(InvalidResourceException):
         function.to_cloudformation(**self.kwargs)
 def test_with_image_uri_invalid_package_type(self):
     function = SamFunction("foo")
     function.ImageUri = "123456789.dkr.ecr.us-east-1.amazonaws.com/myimage:latest"
     function.PackageType = "fake"
     with pytest.raises(InvalidResourceException):
         function.to_cloudformation(**self.kwargs)