Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: third_party/gsutil/gslib/tests/test_rb.py

Issue 1377933002: [catapult] - Copy Telemetry's gsutilz over to third_party. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Rename to gsutil. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # -*- coding: utf-8 -*-
2 # Copyright 2014 Google Inc. All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 """Integration tests for rb command."""
16
17 from __future__ import absolute_import
18
19 import gslib.tests.testcase as testcase
20 from gslib.tests.util import ObjectToURI as suri
21
22
23 class TestRb(testcase.GsUtilIntegrationTestCase):
24 """Integration tests for rb command."""
25
26 def test_rb_bucket_works(self):
27 bucket_uri = self.CreateBucket()
28 self.RunGsUtil(['rb', suri(bucket_uri)])
29 stderr = self.RunGsUtil(
30 ['ls', '-Lb', 'gs://%s' % self.nonexistent_bucket_name],
31 return_stderr=True, expected_status=1)
32 self.assertIn('404', stderr)
33
34 def test_rb_bucket_not_empty(self):
35 bucket_uri = self.CreateBucket(test_objects=1)
36 stderr = self.RunGsUtil(['rb', suri(bucket_uri)], expected_status=1,
37 return_stderr=True)
38 self.assertIn('BucketNotEmpty', stderr)
39
40 def test_rb_versioned_bucket_not_empty(self):
41 bucket_uri = self.CreateVersionedBucket(test_objects=1)
42 stderr = self.RunGsUtil(['rb', suri(bucket_uri)], expected_status=1,
43 return_stderr=True)
44 self.assertIn('Bucket is not empty. Note: this is a versioned bucket',
45 stderr)
46
47 def test_rb_minus_f(self):
48 bucket_uri = self.CreateBucket()
49 stderr = self.RunGsUtil([
50 'rb', '-f', 'gs://%s' % self.nonexistent_bucket_name,
51 suri(bucket_uri)], return_stderr=True, expected_status=1)
52 # There should be no error output, and existing bucket named after
53 # non-existent bucket should be gone.
54 self.assertNotIn('bucket does not exist.', stderr)
55 stderr = self.RunGsUtil(
56 ['ls', '-Lb', suri(bucket_uri)], return_stderr=True, expected_status=1)
57 self.assertIn('404', stderr)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698