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

Unified Diff: scripts/slave/unittests/slave_utils_test.py

Issue 2442693003: Upload retry summary to desired location instead of uploading then moving. (Closed)
Patch Set: Change slave_utils.GSUtilCopyFile to take an optional dest filename. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/slave/slave_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/unittests/slave_utils_test.py
diff --git a/scripts/slave/unittests/slave_utils_test.py b/scripts/slave/unittests/slave_utils_test.py
index 00e6797349077845fd9301cf25062d0bd2154687..629b128aa88b8212a55a55c724a636170c7fcf39 100755
--- a/scripts/slave/unittests/slave_utils_test.py
+++ b/scripts/slave/unittests/slave_utils_test.py
@@ -114,20 +114,45 @@ class TestGetBuildRevisions(unittest.TestCase):
self.assertEquals(None, webkit_revision)
+@mock.patch('__main__.slave_utils.GSUtilSetup',
+ mock.MagicMock(return_value='/mock/gsutil'))
+@mock.patch('__main__.chromium_utils.RunCommand')
class TestGSUtil(unittest.TestCase):
- @mock.patch('__main__.slave_utils.GSUtilSetup', return_value='/mock/gsutil')
- @mock.patch('__main__.chromium_utils.RunCommand')
+
def testGSUtilCopyCacheControl(self, # pylint: disable=R0201
- run_command_mock, gs_util_setup_mock):
- slave_utils.GSUtilCopyFile('foo', 'bar',
- cache_control='mock_cache')
- run_command_mock.assert_called_with(['/mock/gsutil', '-h',
- 'Cache-Control:mock_cache', 'cp', 'file://foo',
- 'file://bar/foo'])
- slave_utils.GSUtilCopyDir('foo', 'bar',
- cache_control='mock_cache')
- run_command_mock.assert_called_with(['/mock/gsutil', '-m', '-h',
- 'Cache-Control:mock_cache', 'cp', '-R', 'foo', 'bar'])
+ run_command_mock):
+ slave_utils.GSUtilCopyFile('foo', 'bar', cache_control='mock_cache')
+ run_command_mock.assert_called_with([
+ '/mock/gsutil',
+ '-h',
+ 'Cache-Control:mock_cache',
+ 'cp',
+ 'file://foo',
+ 'file://bar/foo',
+ ])
+ slave_utils.GSUtilCopyDir('foo', 'bar', cache_control='mock_cache')
+ run_command_mock.assert_called_with([
+ '/mock/gsutil',
+ '-m',
+ '-h',
+ 'Cache-Control:mock_cache',
+ 'cp',
+ '-R',
+ 'foo',
+ 'bar',
+ ])
+
+ def testGSUtilCopyFileWithDestFilename(self, # pylint: disable=R0201
+ run_command_mock):
+ slave_utils.GSUtilCopyFile(
+ '/my/local/path/foo.txt', 'gs://bucket/dest/dir',
+ dest_filename='bar.txt')
+ run_command_mock.assert_called_with([
+ '/mock/gsutil',
+ 'cp',
+ 'file:///my/local/path/foo.txt',
+ 'gs://bucket/dest/dir/bar.txt',
+ ])
class GetGitRevisionTest(unittest.TestCase):
« no previous file with comments | « scripts/slave/slave_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698