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

Unified Diff: extensions/common/api/externs_checker_test.py

Issue 1761663002: [Closure Externs] Add more APIs to the presubmit warning list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fixes Created 4 years, 9 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 | « extensions/common/api/externs_checker.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/api/externs_checker_test.py
diff --git a/extensions/common/api/externs_checker_test.py b/extensions/common/api/externs_checker_test.py
index 73b65fa3c06266487bd14780d702d115f14962ed..9bcc651b679ab2d2495089f0ab50ef34b7fb6a06 100755
--- a/extensions/common/api/externs_checker_test.py
+++ b/extensions/common/api/externs_checker_test.py
@@ -18,8 +18,9 @@ from PRESUBMIT_test_mocks import MockInputApi, MockOutputApi, MockFile
class ExternsCheckerTest(unittest.TestCase):
API_PAIRS = {'a': '1', 'b': '2', 'c': '3'}
- def _runChecks(self, files):
+ def _runChecks(self, files, exists=lambda f: True):
input_api = MockInputApi()
+ input_api.os_path.exists = exists
input_api.files = [MockFile(f, '') for f in files]
output_api = MockOutputApi()
checker = ExternsChecker(input_api, output_api, self.API_PAIRS)
@@ -58,6 +59,12 @@ class ExternsCheckerTest(unittest.TestCase):
self.assertEquals(1, len(results[0].items))
self.assertEquals('c', results[0].items[0])
+ def testApiFileDoesNotExist(self):
+ exists = lambda f: f in ['a', 'b', 'c', '1', '2']
+ with self.assertRaises(OSError) as e:
+ self._runChecks(['a'], exists)
+ self.assertEqual('Path Not Found: 3', str(e.exception))
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « extensions/common/api/externs_checker.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698