summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatt Houglum <houglum@google.com>2016-09-21 20:37:26 -0700
committerMatt Houglum <houglum@google.com>2016-10-18 19:54:23 -0700
commitf4ad3dfffb9feef5fd90c337b934a13c107e8532 (patch)
treed11f2f953f240199a96d471ec7e294a34d9423f8 /tests
parent5e176f5d037912018f7b36f00d2cfe41dd4a2d62 (diff)
downloadboto-f4ad3dfffb9feef5fd90c337b934a13c107e8532.tar.gz
Add gs support for object-level storage class features.
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/gs/test_basic.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/tests/integration/gs/test_basic.py b/tests/integration/gs/test_basic.py
index f2fc9ec0..2ba9b579 100644
--- a/tests/integration/gs/test_basic.py
+++ b/tests/integration/gs/test_basic.py
@@ -56,15 +56,22 @@ LIFECYCLE_EMPTY = ('<?xml version="1.0" encoding="UTF-8"?>'
LIFECYCLE_DOC = ('<?xml version="1.0" encoding="UTF-8"?>'
'<LifecycleConfiguration><Rule>'
'<Action><Delete/></Action>'
- '<Condition><Age>365</Age>'
+ '<Condition>''<IsLive>true</IsLive>'
+ '<MatchesStorageClass>STANDARD</MatchesStorageClass>'
+ '<Age>365</Age>'
'<CreatedBefore>2013-01-15</CreatedBefore>'
'<NumberOfNewerVersions>3</NumberOfNewerVersions>'
- '<IsLive>true</IsLive></Condition>'
- '</Rule></LifecycleConfiguration>')
-LIFECYCLE_CONDITIONS = {'Age': '365',
- 'CreatedBefore': '2013-01-15',
- 'NumberOfNewerVersions': '3',
- 'IsLive': 'true'}
+ '</Condition></Rule><Rule>'
+ '<Action><SetStorageClass>NEARLINE</SetStorageClass></Action>'
+ '<Condition><Age>366</Age>'
+ '</Condition></Rule></LifecycleConfiguration>')
+LIFECYCLE_CONDITIONS_FOR_DELETE_RULE = {
+ 'Age': '365',
+ 'CreatedBefore': '2013-01-15',
+ 'NumberOfNewerVersions': '3',
+ 'IsLive': 'true',
+ 'MatchesStorageClass': ['STANDARD']}
+LIFECYCLE_CONDITIONS_FOR_SET_STORAGE_CLASS_RULE = {'Age': '366'}
# Regexp for matching project-private default object ACL.
PROJECT_PRIVATE_RE = ('\s*<AccessControlList>\s*<Entries>\s*<Entry>'
@@ -412,7 +419,11 @@ class GSBasicTest(GSTestCase):
self.assertEqual(xml, LIFECYCLE_EMPTY)
# set lifecycle config
lifecycle_config = LifecycleConfig()
- lifecycle_config.add_rule('Delete', None, LIFECYCLE_CONDITIONS)
+ lifecycle_config.add_rule(
+ 'Delete', None, LIFECYCLE_CONDITIONS_FOR_DELETE_RULE)
+ lifecycle_config.add_rule(
+ 'SetStorageClass', 'NEARLINE',
+ LIFECYCLE_CONDITIONS_FOR_SET_STORAGE_CLASS_RULE)
bucket.configure_lifecycle(lifecycle_config)
xml = bucket.get_lifecycle_config().to_xml()
self.assertEqual(xml, LIFECYCLE_DOC)
@@ -428,7 +439,11 @@ class GSBasicTest(GSTestCase):
self.assertEqual(xml, LIFECYCLE_EMPTY)
# set lifecycle config
lifecycle_config = LifecycleConfig()
- lifecycle_config.add_rule('Delete', None, LIFECYCLE_CONDITIONS)
+ lifecycle_config.add_rule(
+ 'Delete', None, LIFECYCLE_CONDITIONS_FOR_DELETE_RULE)
+ lifecycle_config.add_rule(
+ 'SetStorageClass', 'NEARLINE',
+ LIFECYCLE_CONDITIONS_FOR_SET_STORAGE_CLASS_RULE)
uri.configure_lifecycle(lifecycle_config)
xml = uri.get_lifecycle_config().to_xml()
self.assertEqual(xml, LIFECYCLE_DOC)