Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/unit/customizations/servicecatalog/test_utils.py
1569 views
1
# Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
14
from awscli.customizations.servicecatalog import utils
15
from awscli.testutils import unittest
16
17
18
class TestUtils(unittest.TestCase):
19
20
def test_make_url_no_version(self):
21
url = utils.make_url('us-east-1', 'foo-bucket-name', 'a/b/c', None)
22
self.assertEqual("https://s3.amazonaws.com/foo-bucket-name/a/b/c", url)
23
24
def test_make_url_no_version_other_region(self):
25
url = utils.make_url('us-west-2', 'foo-bucket-name', 'a/b/c', None)
26
self.assertEqual(
27
"https://s3-us-west-2.amazonaws.com/foo-bucket-name/a/b/c",
28
url)
29
30
def test_make_url_with_version(self):
31
url = utils.make_url('us-east-1', 'foo-bucket-name', 'a/b/c', 5)
32
self.assertEqual(
33
"https://s3.amazonaws.com/foo-bucket-name/a/b/c?versionId=5",
34
url)
35
36