Implementation of bucket.list_versions
This commit is contained in:
parent
e972000bb4
commit
4cc45c3ac5
3 changed files with 104 additions and 3 deletions
|
|
@ -543,3 +543,29 @@ def test_key_version():
|
|||
|
||||
key = bucket.get_key('the-key')
|
||||
key.version_id.should.equal('1')
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_list_versions():
|
||||
conn = boto.connect_s3('the_key', 'the_secret')
|
||||
bucket = conn.create_bucket('foobar')
|
||||
bucket.configure_versioning(versioning=True)
|
||||
|
||||
key = Key(bucket, 'the-key')
|
||||
key.version_id.should.be.none
|
||||
key.set_contents_from_string("Version 1")
|
||||
key.version_id.should.equal('0')
|
||||
key.set_contents_from_string("Version 2")
|
||||
key.version_id.should.equal('1')
|
||||
|
||||
versions = list(bucket.list_versions())
|
||||
|
||||
versions.should.have.length_of(2)
|
||||
|
||||
versions[0].name.should.equal('the-key')
|
||||
versions[0].version_id.should.equal('0')
|
||||
versions[0].get_contents_as_string().should.equal("Version 1")
|
||||
|
||||
versions[1].name.should.equal('the-key')
|
||||
versions[1].version_id.should.equal('1')
|
||||
versions[1].get_contents_as_string().should.equal("Version 2")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue