Exemplo n.º 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)
Exemplo n.º 2
0
def test_localhost_bucket():
    expect(bucket_name_from_url("https://wfoobar.localhost:5000/abc")).should.equal(
        "wfoobar"
    )
Exemplo n.º 3
0
def test_localhost_without_bucket():
    expect(bucket_name_from_url("https://www.localhost:5000/def")).should.equal(None)
Exemplo n.º 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"]
Exemplo n.º 5
0
def test_base_url():
    expect(bucket_name_from_url("https://s3.amazonaws.com/")).should.equal(None)
Exemplo n.º 6
0
def test_base_url():
    expect(bucket_name_from_url('https://s3.amazonaws.com/')).should.equal(None)
Exemplo n.º 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'])
Exemplo n.º 8
0
def test_localhost_without_bucket():
    expect(bucket_name_from_url(
        'https://www.localhost:5000/def')).should.equal(None)
Exemplo n.º 9
0
def test_localhost_bucket():
    expect(bucket_name_from_url('https://wfoobar.localhost:5000/abc')
           ).should.equal("wfoobar")
Exemplo n.º 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')