OLD | NEW |
(Empty) | |
| 1 # -*- coding: utf-8 -*- |
| 2 # Copyright 2015 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 gsutil --trace-token option.""" |
| 16 |
| 17 from __future__ import absolute_import |
| 18 |
| 19 from gslib.cs_api_map import ApiSelector |
| 20 import gslib.tests.testcase as testcase |
| 21 from gslib.tests.testcase.integration_testcase import SkipForS3 |
| 22 from gslib.tests.util import ObjectToURI as suri |
| 23 |
| 24 |
| 25 @SkipForS3('--trace-token is supported only on GCS JSON API.') |
| 26 class TestTraceTokenOption(testcase.GsUtilIntegrationTestCase): |
| 27 """Integration tests for gsutil --trace-token option.""" |
| 28 |
| 29 def test_minus_tracetoken_cat(self): |
| 30 """Tests cat command with trace-token option.""" |
| 31 key_uri = self.CreateObject(contents='0123456789') |
| 32 (_, stderr) = self.RunGsUtil( |
| 33 ['-D', '--trace-token=THISISATOKEN', 'cat', suri(key_uri)], |
| 34 return_stdout=True, return_stderr=True) |
| 35 if self.test_api == ApiSelector.JSON: |
| 36 self.assertIn('You are running gsutil with trace output enabled.', stderr) |
| 37 self.assertRegexpMatches( |
| 38 stderr, r'.*GET.*b/%s/o/%s\?.*&trace=token%%3ATHISISATOKEN' % |
| 39 (key_uri.bucket_name, key_uri.object_name)) |
OLD | NEW |