Example #1
0
def test_force_ignore_subdomain_for_bucketnames():
    with patch("moto.s3.utils.S3_IGNORE_SUBDOMAIN_BUCKETNAME", True):
        expect(
            bucket_name_from_url("https://subdomain.localhost:5000/abc/resource")
        ).should.equal(None)
Example #2
0
def test_localhost_bucket():
    expect(bucket_name_from_url("https://wfoobar.localhost:5000/abc")).should.equal(
        "wfoobar"
    )
Example #3
0
def test_localhost_without_bucket():
    expect(bucket_name_from_url("https://www.localhost:5000/def")).should.equal(None)
Example #4
0
def test_force_ignore_subdomain_for_bucketnames():
    os.environ["S3_IGNORE_SUBDOMAIN_BUCKETNAME"] = "1"
    expect(
        bucket_name_from_url("https://subdomain.localhost:5000/abc/resource")
    ).should.equal(None)
    del os.environ["S3_IGNORE_SUBDOMAIN_BUCKETNAME"]
Example #5
0
def test_base_url():
    expect(bucket_name_from_url("https://s3.amazonaws.com/")).should.equal(None)
Example #6
0
def test_base_url():
    expect(bucket_name_from_url('https://s3.amazonaws.com/')).should.equal(None)
Example #7
0
def test_force_ignore_subdomain_for_bucketnames():
    os.environ['S3_IGNORE_SUBDOMAIN_BUCKETNAME'] = '1'
    expect(bucket_name_from_url('https://subdomain.localhost:5000/abc/resource')).should.equal(None)
    del(os.environ['S3_IGNORE_SUBDOMAIN_BUCKETNAME'])
Example #8
0
def test_localhost_without_bucket():
    expect(bucket_name_from_url(
        'https://www.localhost:5000/def')).should.equal(None)
Example #9
0
def test_localhost_bucket():
    expect(bucket_name_from_url('https://wfoobar.localhost:5000/abc')
           ).should.equal("wfoobar")
Example #10
0
def test_base_url_ordinary_calling():
    expect(bucket_name_from_url('https://s3.amazonaws.com/bucket/')).should.equal('bucket')
    expect(bucket_name_from_url('https://s3.amazonaws.com/bucket/key')).should.equal('bucket')