コード例 #1
0
ファイル: test_s3_utils.py プロジェクト: botify-labs/moto
def test_parse_region_from_url():
    expected = 'us-west-2'
    for url in ['http://s3-us-west-2.amazonaws.com/bucket',
                'http://s3.us-west-2.amazonaws.com/bucket',
                'http://bucket.s3-us-west-2.amazonaws.com',
                'https://s3-us-west-2.amazonaws.com/bucket',
                'https://s3.us-west-2.amazonaws.com/bucket',
                'https://bucket.s3-us-west-2.amazonaws.com']:
        parse_region_from_url(url).should.equal(expected)

    expected = 'us-east-1'
    for url in ['http://s3.amazonaws.com/bucket',
                'http://bucket.s3.amazonaws.com',
                'https://s3.amazonaws.com/bucket',
                'https://bucket.s3.amazonaws.com']:
        parse_region_from_url(url).should.equal(expected)
コード例 #2
0
ファイル: test_s3_utils.py プロジェクト: zjiawei3/moto
def test_parse_region_from_url():
    expected = 'us-west-2'
    for url in [
            'http://s3-us-west-2.amazonaws.com/bucket',
            'http://s3.us-west-2.amazonaws.com/bucket',
            'http://bucket.s3-us-west-2.amazonaws.com',
            'https://s3-us-west-2.amazonaws.com/bucket',
            'https://s3.us-west-2.amazonaws.com/bucket',
            'https://bucket.s3-us-west-2.amazonaws.com'
    ]:
        parse_region_from_url(url).should.equal(expected)

    expected = 'us-east-1'
    for url in [
            'http://s3.amazonaws.com/bucket', 'http://bucket.s3.amazonaws.com',
            'https://s3.amazonaws.com/bucket',
            'https://bucket.s3.amazonaws.com'
    ]:
        parse_region_from_url(url).should.equal(expected)
コード例 #3
0
def test_parse_region_from_url():
    expected = "us-west-2"
    for url in [
        "http://s3-us-west-2.amazonaws.com/bucket",
        "http://s3.us-west-2.amazonaws.com/bucket",
        "http://bucket.s3-us-west-2.amazonaws.com",
        "https://s3-us-west-2.amazonaws.com/bucket",
        "https://s3.us-west-2.amazonaws.com/bucket",
        "https://bucket.s3-us-west-2.amazonaws.com",
    ]:
        parse_region_from_url(url).should.equal(expected)

    expected = "us-east-1"
    for url in [
        "http://s3.amazonaws.com/bucket",
        "http://bucket.s3.amazonaws.com",
        "https://s3.amazonaws.com/bucket",
        "https://bucket.s3.amazonaws.com",
    ]:
        parse_region_from_url(url).should.equal(expected)