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

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

Issue 1380943003: Roll version of gsutil to 4.15. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 5 years 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
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # Copyright 2013 Google Inc. All Rights Reserved. 2 # Copyright 2013 Google Inc. All Rights Reserved.
3 # 3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with 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 6 # You may obtain a copy of the License at
7 # 7 #
8 # http://www.apache.org/licenses/LICENSE-2.0 8 # http://www.apache.org/licenses/LICENSE-2.0
9 # 9 #
10 # Unless required by applicable law or agreed to in writing, software 10 # Unless required by applicable law or agreed to in writing, software
(...skipping 30 matching lines...) Expand all
41 return_stderr=True, expected_status=1) 41 return_stderr=True, expected_status=1)
42 self.assertIn('Invalid range', stderr) 42 self.assertIn('Invalid range', stderr)
43 43
44 # Test various valid ranges. 44 # Test various valid ranges.
45 stdout = self.RunGsUtil(['cat', '-r 1-3', suri(key_uri)], 45 stdout = self.RunGsUtil(['cat', '-r 1-3', suri(key_uri)],
46 return_stdout=True) 46 return_stdout=True)
47 self.assertEqual('123', stdout) 47 self.assertEqual('123', stdout)
48 stdout = self.RunGsUtil(['cat', '-r 8-', suri(key_uri)], 48 stdout = self.RunGsUtil(['cat', '-r 8-', suri(key_uri)],
49 return_stdout=True) 49 return_stdout=True)
50 self.assertEqual('89', stdout) 50 self.assertEqual('89', stdout)
51 stdout = self.RunGsUtil(['cat', '-r 0-0', suri(key_uri)],
52 return_stdout=True)
53 self.assertEqual('0', stdout)
51 stdout = self.RunGsUtil(['cat', '-r -3', suri(key_uri)], 54 stdout = self.RunGsUtil(['cat', '-r -3', suri(key_uri)],
52 return_stdout=True) 55 return_stdout=True)
53 self.assertEqual('789', stdout) 56 self.assertEqual('789', stdout)
54 57
55 def test_cat_version(self): 58 def test_cat_version(self):
56 """Tests cat command on versioned objects.""" 59 """Tests cat command on versioned objects."""
57 bucket_uri = self.CreateVersionedBucket() 60 bucket_uri = self.CreateVersionedBucket()
58 # Create 2 versions of an object. 61 # Create 2 versions of an object.
59 uri1 = self.CreateObject(bucket_uri=bucket_uri, contents='data1') 62 uri1 = self.CreateObject(bucket_uri=bucket_uri, contents='data1')
60 uri2 = self.CreateObject(bucket_uri=bucket_uri, 63 uri2 = self.CreateObject(bucket_uri=bucket_uri,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return_stdout=True, return_stderr=True, expected_status=1) 104 return_stdout=True, return_stderr=True, expected_status=1)
102 105
103 # If first object is invalid, exception should halt output immediately. 106 # If first object is invalid, exception should halt output immediately.
104 self.assertNotIn(data1, stdout) 107 self.assertNotIn(data1, stdout)
105 self.assertIn('NotFoundException', stderr) 108 self.assertIn('NotFoundException', stderr)
106 109
107 # Two valid objects should both print successfully. 110 # Two valid objects should both print successfully.
108 stdout = self.RunGsUtil(['cat', suri(obj_uri1), suri(obj_uri2)], 111 stdout = self.RunGsUtil(['cat', suri(obj_uri1), suri(obj_uri2)],
109 return_stdout=True) 112 return_stdout=True)
110 self.assertIn(data1 + data2, stdout) 113 self.assertIn(data1 + data2, stdout)
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/tests/test_Doption.py ('k') | third_party/gsutil/gslib/tests/test_cp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698