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

Unified Diff: appengine/findit/util_scripts/test/script_util_test.py

Issue 2432113002: [Findit] Add local_git_repository (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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 | « appengine/findit/util_scripts/test/__init__.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/util_scripts/test/script_util_test.py
diff --git a/appengine/findit/util_scripts/test/script_util_test.py b/appengine/findit/util_scripts/test/script_util_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..9237e24ae944e1cf7e8ce0e2a4df6151abf12c10
--- /dev/null
+++ b/appengine/findit/util_scripts/test/script_util_test.py
@@ -0,0 +1,30 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import subprocess
+
+import script_util
+from testing_utils import testing
+
+
+class ScriptUtilTest(testing.AppengineTestCase):
+
+ def testGetLocalGitCommandOutput(self):
+ class _MockProcess(object):
+ def __init__(self, command, *_):
+ self.command = command
+
+ def communicate(self, *_):
+ return self.command, 'dummy'
+
+ @property
+ def returncode(self):
+ return 1 if self.command == 'dummy' else 0
+
+ self.mock(subprocess, 'Popen', lambda command, **_: _MockProcess(command))
+ output = script_util.GetCommandOutput('command')
+ self.assertEqual(output, 'command')
+
+ output = script_util.GetCommandOutput('dummy')
+ self.assertEqual(output, None)
« no previous file with comments | « appengine/findit/util_scripts/test/__init__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698