def test_run_exception(self): """ Controller.run() exception test """ controller = Controller.__new__(Controller) with self.assertRaises(SrcError) as context: controller.run() self.assertTrue(SrcError == context.expected)
def test_run(self, args): """ Controller.run() test """ Config.params['cfg'] = 'setup.cfg' controller = Controller.__new__(Controller) setattr(controller, 'ioargs', args) controller.run() self.assertTrue(True)
def test_local_version_action_exception(self): """ Controller.local_version() exception test """ Config.params['cfg'] = 'wrong.cfg' controller = Controller.__new__(Controller) with self.assertRaises(SrcError) as context: controller.local_version() self.assertTrue(SrcError == context.expected)
def test_update_action_exception(self): """ Controller.update_action() exception test """ del Config.params['update'] controller = Controller.__new__(Controller) with self.assertRaises(SrcError) as context: controller.update_action() self.assertTrue(SrcError == context.expected)
def test_scan_action_exception(self): """ Controller.scan_action() exception test """ controller = Controller.__new__(Controller) with self.assertRaises(SrcError) as context: controller.scan_action(params={ 'host': 'http://example.com', 'port': 80 }) self.assertTrue(SrcError == context.expected)
def test_version_action(self): """ Controller.version_action() test """ Config.params['cfg'] = 'setup.cfg' controller = Controller.__new__(Controller) self.assertIsNone(controller.version_action())
def setUp(self): self.controller = Controller.__new__(Controller) self.config = CoreConfig