示例#1
0
    def test_stack_template_url(self):
        context = mock_context("mynamespace")
        blueprint = TestBlueprint(name="myblueprint", context=context)

        region = "us-east-1"
        endpoint = "https://example.com"
        session = get_session(region)
        provider = Provider(session)
        action = BaseAction(
            context=context,
            provider_builder=MockProviderBuilder(provider, region=region)
        )

        with mock.patch('stacker.actions.base.get_s3_endpoint', autospec=True,
                        return_value=endpoint):
            self.assertEqual(
                action.stack_template_url(blueprint),
                "%s/%s/stack_templates/%s/%s-%s.json" % (
                    endpoint,
                    "stacker-mynamespace",
                    "mynamespace-myblueprint",
                    "myblueprint",
                    MOCK_VERSION
                )
            )
示例#2
0
    def test_stack_template_url(self):
        test_cases = (
            ("us-east-1", "s3.amazonaws.com"),
            ("us-west-1", "s3-us-west-1.amazonaws.com"),
            ("eu-west-1", "s3-eu-west-1.amazonaws.com"),
            ("sa-east-1", "s3-sa-east-1.amazonaws.com"),
        )
        context = mock_context("mynamespace")
        blueprint = TestBlueprint(name="myblueprint", context=context)

        for region, endpoint in test_cases:
            provider = Provider(region)
            action = BaseAction(context=context, provider=provider)
            self.assertEqual(
                action.stack_template_url(blueprint),
                "https://%s/%s/%s-%s.json" %
                (endpoint, "stacker-mynamespace", "myblueprint", MOCK_VERSION))
示例#3
0
    def test_stack_template_url(self):
        context = mock_context("mynamespace")
        blueprint = TestBlueprint(name="myblueprint", context=context)

        region = "us-east-1"
        endpoint = "https://example.com"
        session = get_session(region)
        provider = Provider(session)
        action = BaseAction(context=context,
                            provider_builder=MockProviderBuilder(
                                provider, region=region))

        with mock.patch('stacker.actions.base.get_s3_endpoint',
                        autospec=True,
                        return_value=endpoint):
            self.assertEqual(
                action.stack_template_url(blueprint),
                "%s/%s/stack_templates/%s/%s-%s.json" %
                (endpoint, "stacker-mynamespace", "mynamespace-myblueprint",
                 "myblueprint", MOCK_VERSION))