def testOnlyOwnersFiles(self): mock_change = MockChange([ 'some/path/OWNERS', 'A\Windows\Path\OWNERS', ]) results = PRESUBMIT.GetPreferredTryMasters(None, mock_change) self.assertEqual({}, results)
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] input_api.change = MockChange(input_api.files) output_api = MockOutputApi() checker = ExternsChecker(input_api, output_api, self.API_PAIRS) return checker.RunChecks()
def testActionXMLChanged(self): mock_input_api = MockInputApi() lines = ['<input id="testinput" pref="testpref"', 'metric="validaction" type="checkbox" dialog-pref>'] mock_input_api.files = [MockFile('path/valid.html', lines)] mock_input_api.change = MockChange(['path/valid.html','actions.xml']) action_xml_path = self._createActionXMLFile() self.assertEqual([], PRESUBMIT.CheckUserActionUpdate(mock_input_api, MockOutputApi(), action_xml_path))
def testNoFiles(self): mock_change = MockChange([]) results = PRESUBMIT.GetPreferredTryMasters(None, mock_change) self.assertEqual({}, results)