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

Unified Diff: appengine/findit/lib/gitiles/test/repo_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
Index: appengine/findit/lib/gitiles/test/repo_util_test.py
diff --git a/appengine/findit/lib/gitiles/test/repo_util_test.py b/appengine/findit/lib/gitiles/test/repo_util_test.py
index a5f62edc4efaa9d4f8f9f29ddb868d2338b3d11b..1ebb9beb1ff0b4435cc030b89f88c48f05826428 100644
--- a/appengine/findit/lib/gitiles/test/repo_util_test.py
+++ b/appengine/findit/lib/gitiles/test/repo_util_test.py
@@ -4,6 +4,7 @@
import json
import StringIO
+import subprocess
from testing_utils import testing
import textwrap
import urllib2
@@ -133,3 +134,28 @@ class RepoUtilTest(testing.AppengineTestCase):
reverted_revision = repo_util.GetRevertedRevision(message)
self.assertIsNone(reverted_revision)
+
+ def testGetLocalGitCommandOutput(self):
+ class _MockProcess(object):
+ def __init__(self, command, *_):
+ self.command = command
+
+ def communicate(self, *_):
+ return self.command, 'dummy'
+
+ @property
+ def returncode(self):
wrengr 2016/11/01 20:26:53 -> ``return 1 if self.command == 'dummy' else 0``
Sharu Jiang 2016/11/05 01:18:16 Done.
+ if self.command == 'dummy':
+ return 1
+
+ return 0
+
+ def _MockPopen(command, **_):
+ return _MockProcess(command)
+
+ self.mock(subprocess, 'Popen', _MockPopen)
wrengr 2016/11/01 20:26:53 -> ``self.mock(subprocess, 'Popen', lambd
Sharu Jiang 2016/11/05 01:18:16 Done.
+ output = repo_util.GetCommandOutput('command')
+ self.assertEqual(output, 'command')
+
+ output = repo_util.GetCommandOutput('dummy')
+ self.assertEqual(output, None)

Powered by Google App Engine
This is Rietveld 408576698