def runApplicationWithArgv(self, argv, print_result, os_walk, mock_open): def store_result(result, options): self.fileInfos = list(result) os_walk.return_value = [('.', [], ['a.cpp'])] mock_open.return_value.read.return_value = self.source_code print_result.side_effect = store_result hfcca_main(argv)
def testMutipleFilesInArgv(self, print_result, os_walk, mock_open): def check_result(result, options): fileInfos = list(result) self.assertEqual(1, len(fileInfos)) self.assertEqual('foo', fileInfos[0][0].name) os_walk.return_value = [('.', [], ['a.cpp'])] mock_open.return_value.read.return_value = "void foo(){}" print_result.side_effect = check_result hfcca_main(['hfcca'])
def testEmptyResult(self, print_result, os_walk): os_walk.return_value = [('.', [], [])] print_result.side_effect = self.check_empty_result hfcca_main(['hfcca'])
def testGetCurrentFolderByDefault(self, print_result, os_walk): print_result.side_effect = self.exhaust_result hfcca_main(['hfcca']) os_walk.assert_called_once_with('.', topdown=False)