def testLoadCommands(self): """Tests import commands correctly.""" fake_module = 'cros_command_test' fake_command_file = '%s.py' % fake_module module_path = ('chromite', 'cli', 'cros', fake_module) self.PatchObject(command, '_FindModules', return_value=[fake_command_file]) # The code doesn't use the return value, so stub it out lazy-like. load_mock = self.PatchObject(cros_import, 'ImportModule', return_value=None) command._ImportCommands('cros') load_mock.assert_called_with(module_path)
def testLoadCommands(self): """Tests import commands correctly.""" fake_module = 'cros_command_test' fake_command_file = os.path.join(constants.CHROMITE_DIR, 'foo', fake_module) module_path = ['chromite', 'foo', fake_module] self.PatchObject(command, '_FindModules', return_value=[fake_command_file]) # The code doesn't use the return value, so stub it out lazy-like. load_mock = self.PatchObject(cros_import, 'ImportModule', return_value=None) command._ImportCommands() load_mock.assert_called_with(module_path)