Example #1
0
def test_anonymous_access(oss):
    oss = OSSFileSystem(anon=True)
    assert oss.ls("") == []
    # TODO: public bucket doesn't work through moto

    with pytest.raises(PermissionError):
        oss.mkdir("newbucket")
Example #2
0
def test_requester_pays(oss):
    fn = test_bucket_name + "/myfile"
    oss = OSSFileSystem(key=key, secret=secret, endpoint=endpoint, requester_pays=True)
    assert oss.additional_header[oss2.headers.OSS_REQUEST_PAYER] == "requester"
    oss.mkdir(test_bucket_name)
    oss.touch(fn)
    with oss.open(fn, "rb") as f:
        assert f.oss.additional_header[oss2.headers.OSS_REQUEST_PAYER] == "requester"