| OLD | NEW |
| 1 #!/usr/bin/env python | |
| 2 # -*- coding: utf-8 -*- | |
| 3 # Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ |
| 4 # Copyright (c) 2010, Eucalyptus Systems, Inc. | 2 # Copyright (c) 2010, Eucalyptus Systems, Inc. |
| 5 # All rights reserved. | 3 # All rights reserved. |
| 6 # | 4 # |
| 7 # Permission is hereby granted, free of charge, to any person obtaining a | 5 # Permission is hereby granted, free of charge, to any person obtaining a |
| 8 # copy of this software and associated documentation files (the | 6 # copy of this software and associated documentation files (the |
| 9 # "Software"), to deal in the Software without restriction, including | 7 # "Software"), to deal in the Software without restriction, including |
| 10 # without limitation the rights to use, copy, modify, merge, publish, dis- | 8 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 11 # tribute, sublicense, and/or sell copies of the Software, and to permit | 9 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 12 # persons to whom the Software is furnished to do so, subject to the fol- | 10 # persons to whom the Software is furnished to do so, subject to the fol- |
| (...skipping 29 matching lines...) Expand all Loading... |
| 42 bucket_name = 'version-%d' % int(time.time()) | 40 bucket_name = 'version-%d' % int(time.time()) |
| 43 bucket = c.create_bucket(bucket_name) | 41 bucket = c.create_bucket(bucket_name) |
| 44 | 42 |
| 45 # now try a get_bucket call and see if it's really there | 43 # now try a get_bucket call and see if it's really there |
| 46 bucket = c.get_bucket(bucket_name) | 44 bucket = c.get_bucket(bucket_name) |
| 47 | 45 |
| 48 # enable versions | 46 # enable versions |
| 49 d = bucket.get_versioning_status() | 47 d = bucket.get_versioning_status() |
| 50 assert not d.has_key('Versioning') | 48 assert not d.has_key('Versioning') |
| 51 bucket.configure_versioning(versioning=True) | 49 bucket.configure_versioning(versioning=True) |
| 52 time.sleep(5) | 50 time.sleep(15) |
| 53 d = bucket.get_versioning_status() | 51 d = bucket.get_versioning_status() |
| 54 assert d['Versioning'] == 'Enabled' | 52 assert d['Versioning'] == 'Enabled' |
| 55 | 53 |
| 56 # create a new key in the versioned bucket | 54 # create a new key in the versioned bucket |
| 57 k = bucket.new_key() | 55 k = bucket.new_key() |
| 58 k.name = 'foobar' | 56 k.name = 'foobar' |
| 59 s1 = 'This is a test of s3 versioning' | 57 s1 = 'This is a test of s3 versioning' |
| 60 s2 = 'This is the second test of s3 versioning' | 58 s2 = 'This is the second test of s3 versioning' |
| 61 k.set_contents_from_string(s1) | 59 k.set_contents_from_string(s1) |
| 62 time.sleep(5) | 60 time.sleep(5) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 # Now suspend Versioning on the bucket | 136 # Now suspend Versioning on the bucket |
| 139 bucket.configure_versioning(False) | 137 bucket.configure_versioning(False) |
| 140 | 138 |
| 141 # now delete all keys and deletemarkers in bucket | 139 # now delete all keys and deletemarkers in bucket |
| 142 for k in bucket.list_versions(): | 140 for k in bucket.list_versions(): |
| 143 bucket.delete_key(k.name, version_id=k.version_id) | 141 bucket.delete_key(k.name, version_id=k.version_id) |
| 144 | 142 |
| 145 # now delete bucket | 143 # now delete bucket |
| 146 c.delete_bucket(bucket) | 144 c.delete_bucket(bucket) |
| 147 print '--- tests completed ---' | 145 print '--- tests completed ---' |
| OLD | NEW |