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)
def test_localhost_bucket(): expect(bucket_name_from_url("https://wfoobar.localhost:5000/abc")).should.equal( "wfoobar" )
def test_localhost_without_bucket(): expect(bucket_name_from_url("https://www.localhost:5000/def")).should.equal(None)
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"]
def test_base_url(): expect(bucket_name_from_url("https://s3.amazonaws.com/")).should.equal(None)
def test_base_url(): expect(bucket_name_from_url('https://s3.amazonaws.com/')).should.equal(None)
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'])
def test_localhost_without_bucket(): expect(bucket_name_from_url( 'https://www.localhost:5000/def')).should.equal(None)
def test_localhost_bucket(): expect(bucket_name_from_url('https://wfoobar.localhost:5000/abc') ).should.equal("wfoobar")
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')