コード例 #1
0
    def test_must_return_lambci_image(self):

        expected = "lambci/lambda:foo"

        image_builder = Mock()
        image_builder.build.return_value = expected

        self.assertEquals(LambdaContainer._get_image(image_builder, 'foo', []), expected)
コード例 #2
0
    def test_must_return_lambci_image(self):

        expected = "lambci/lambda:foo"

        image_builder = Mock()
        image_builder.build.return_value = expected

        self.assertEquals(LambdaContainer._get_image(image_builder, 'foo', []), expected)
コード例 #3
0
    def test_must_return_lambci_image_without_debug(self):
        debug_options = DebugContext()

        expected = "lambci/lambda:foo"

        image_builder = Mock()
        image_builder.build.return_value = expected

        self.assertEqual(LambdaContainer._get_image(image_builder, "foo", [], debug_options), expected)

        image_builder.build.assert_called_with("foo", [], False)
コード例 #4
0
    def test_must_return_lambci_image_with_debug(self):
        debug_options = DebugContext(debug_ports=[1235], debugger_path="a", debug_args="a=b c=d e=f")

        expected = "lambci/lambda:foo"

        image_builder = Mock()
        image_builder.build.return_value = expected

        self.assertEqual(LambdaContainer._get_image(image_builder, "foo", [], debug_options), expected)

        image_builder.build.assert_called_with("foo", [], True)
コード例 #5
0
    def test_must_return_build_image(self):
        expected = "amazon/aws-sam-cli-emulation-image-foo:rapid-x.y.z"

        image_builder = Mock()
        image_builder.build.return_value = expected

        self.assertEqual(
            LambdaContainer._get_image(
                lambda_image=image_builder,
                runtime="foo",
                packagetype=ZIP,
                image=None,
                layers=[],
            ),
            expected,
        )

        image_builder.build.assert_called_with("foo", ZIP, None, [])
コード例 #6
0
    def test_must_return_lambci_image_without_debug(self):
        debug_options = DebugContext()

        expected = "lambci/lambda:foo"

        image_builder = Mock()
        image_builder.build.return_value = expected

        self.assertEqual(
            LambdaContainer._get_image(
                lambda_image=image_builder,
                runtime="foo",
                packagetype=ZIP,
                image=None,
                layers=[],
                debug_options=debug_options,
            ),
            expected,
        )

        image_builder.build.assert_called_with("foo", ZIP, None, [], False)
コード例 #7
0
    def test_must_return_lambci_image_with_debug(self):
        debug_options = DebugContext(debug_ports=[1235],
                                     debugger_path="a",
                                     debug_args="a=b c=d e=f")

        expected = "lambci/lambda:foo"

        image_builder = Mock()
        image_builder.build.return_value = expected

        self.assertEqual(
            LambdaContainer._get_image(
                lambda_image=image_builder,
                runtime="foo",
                packagetype=ZIP,
                image=None,
                layers=[],
                debug_options=debug_options,
            ),
            expected,
        )

        image_builder.build.assert_called_with("foo", ZIP, None, [], True)
コード例 #8
0
    def test_must_return_lambci_image(self):

        runtime = "foo"
        expected = "lambci/lambda:foo"

        self.assertEquals(LambdaContainer._get_image(runtime), expected)