Index: tests/presubmit_unittest.py |
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py |
index 84585e993235f0dc4a92007f4137469066b1a8b3..6c85ac95f4cd26c4fa8364581bd909d4b66dba0c 100755 |
--- a/tests/presubmit_unittest.py |
+++ b/tests/presubmit_unittest.py |
@@ -792,6 +792,25 @@ def CheckChangeOnCommit(input_api, output_api): |
self.fake_root_dir, None, None, |
False, output)) |
+ def testGetTrySlavesExecuter_ok(self): |
+ script_text = ( |
+ 'def GetPreferredTrySlaves():\n' |
+ ' return ["foo", "bar"]\n') |
+ results = presubmit.GetTrySlavesExecuter.ExecPresubmitScript( |
+ script_text, 'path', 'project', None) |
+ self.assertEquals(['foo', 'bar'], results) |
+ |
+ def testGetTrySlavesExecuter_comma(self): |
+ script_text = ( |
+ 'def GetPreferredTrySlaves():\n' |
+ ' return ["foo,bar"]\n') |
+ try: |
+ presubmit.GetTrySlavesExecuter.ExecPresubmitScript( |
+ script_text, 'path', 'project', None) |
+ self.fail() |
+ except presubmit.PresubmitFailure: |
+ pass |
+ |
def testMainUnversioned(self): |
# OptParser calls presubmit.os.path.exists and is a pain when mocked. |
self.UnMock(presubmit.os.path, 'exists') |