OLD | NEW |
(Empty) | |
| 1 # Copyright 2013 Google Inc. All Rights Reserved. |
| 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at |
| 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 # See the License for the specific language governing permissions and |
| 13 # limitations under the License. |
| 14 |
| 15 import gslib.tests.testcase as testcase |
| 16 from gslib.tests.util import ObjectToURI as suri |
| 17 |
| 18 |
| 19 class TestSetVersioning(testcase.GsUtilIntegrationTestCase): |
| 20 """Integration tests for setversioning command.""" |
| 21 |
| 22 def test_off_default(self): |
| 23 bucket_uri = self.CreateBucket() |
| 24 stdout = self.RunGsUtil(['getversioning', |
| 25 suri(bucket_uri)], return_stdout=True) |
| 26 self.assertEqual(stdout.strip(), '%s: Suspended' % suri(bucket_uri)) |
| 27 |
| 28 def test_turning_on(self): |
| 29 bucket_uri = self.CreateBucket() |
| 30 self.RunGsUtil(['setversioning', 'on', suri(bucket_uri)]) |
| 31 stdout = self.RunGsUtil(['getversioning', |
| 32 suri(bucket_uri)], return_stdout=True) |
| 33 self.assertEqual(stdout.strip(), '%s: Enabled' % suri(bucket_uri)) |
| 34 |
| 35 def test_turning_off(self): |
| 36 bucket_uri = self.CreateBucket() |
| 37 self.RunGsUtil(['setversioning', 'on', suri(bucket_uri)]) |
| 38 stdout = self.RunGsUtil(['getversioning', |
| 39 suri(bucket_uri)], return_stdout=True) |
| 40 self.assertEqual(stdout.strip(), '%s: Enabled' % suri(bucket_uri)) |
| 41 self.RunGsUtil(['setversioning', 'off', suri(bucket_uri)]) |
| 42 stdout = self.RunGsUtil(['getversioning', |
| 43 suri(bucket_uri)], return_stdout=True) |
| 44 self.assertEqual(stdout.strip(), '%s: Suspended' % suri(bucket_uri)) |
OLD | NEW |