def test_prepare_11(self): options = TestOptions() options.test_8() console = Console() console._parser = mock.Mock() console._parser.parse_args = mock.Mock() console._parser.parse_args.return_value = (options, None) check = console.prepare() self.assertTrue(check) return
def test_prepare_3(self): """tear down test. """ options = TestOptions() console = Console() console._parser = mock.Mock() console._parser.parse_args = mock.Mock() console._parser.parse_args.return_value = (options, None) check = console.prepare() self.assertFalse(check) return
def test_prepare_10(self): options = TestOptions() options.test_1() # mock_serial_2.open = mock.Mock(side_effect=SerialException('Attempting to use a port that is not open')) console = Console() console._parser = mock.Mock() console._parser.parse_args = mock.Mock() console._parser.parse_args.return_value = (options, None) check = console.prepare() self.assertFalse(check) return
def test_constructor(self): """tear down test. """ console = Console() self.assertIsNone(console.device) self.assertIsNone(console.options) return
def test_run_2(self): """tear down test. """ options = TestOptions() options.test_6() console = Console() console._parser = mock.Mock() console._parser.parse_args = mock.Mock() console._parser.parse_args.return_value = (options, None) check1 = console.prepare() check2 = console.run() self.assertTrue(check1) self.assertTrue(check2) return
# limitations under the License. # # Copyright (C) 2017, Kai Raphahn <*****@*****.**> # import sys import easyb from easyb.console import Console if __name__ == '__main__': easyb.log.file_name = "easyb-tool.log" check = easyb.conf.load("config.json") if check is False: easyb.log.error("Unable to load config!") sys.exit(1) main = Console() if main.prepare() is False: sys.exit(1) if main.run() is False: sys.exit(1) if main.close() is False: sys.exit(1) sys.exit(0)