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

Side by Side Diff: third_party/gsutil/gslib/tests/test_storage_url.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
16 """Unit tests for storage URLs."""
17
18 from __future__ import absolute_import
19
20
21 from gslib.storage_url import IsFileUrlString
22 from gslib.storage_url import StorageUrlFromString
23 import gslib.tests.testcase as testcase
24
25
26 class TestStorageUrl(testcase.GsUtilUnitTestCase):
27 """Unit tests for storage URLs."""
28
29 def setUp(self):
30 super(TestStorageUrl, self).setUp()
31
32 def test_is_file_url_string(self):
33 self.assertTrue(IsFileUrlString('abc'))
34 self.assertTrue(IsFileUrlString('file://abc'))
35 self.assertFalse(IsFileUrlString('gs://abc'))
36 self.assertFalse(IsFileUrlString('s3://abc'))
37
38 def test_storage_url_from_string(self):
39 storage_url = StorageUrlFromString('abc')
40 self.assertTrue(storage_url.IsFileUrl())
41 self.assertEquals('abc', storage_url.object_name)
42
43 storage_url = StorageUrlFromString('file://abc/123')
44 self.assertTrue(storage_url.IsFileUrl())
45 self.assertEquals('abc/123', storage_url.object_name)
46
47 storage_url = StorageUrlFromString('gs://abc/123')
48 self.assertTrue(storage_url.IsCloudUrl())
49 self.assertEquals('abc', storage_url.bucket_name)
50 self.assertEquals('123', storage_url.object_name)
51
52 storage_url = StorageUrlFromString('s3://abc/123')
53 self.assertTrue(storage_url.IsCloudUrl())
54 self.assertEquals('abc', storage_url.bucket_name)
55 self.assertEquals('123', storage_url.object_name)
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/tests/test_stat.py ('k') | third_party/gsutil/gslib/tests/test_tabcomplete.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698