def test_send_bad_message(self): with self.assertSendHeadboard(b"1 HELLO *115\n") as executor: ec = HeadController(executor, required_module="EXTRUDER", ready_callback=self.raiseException) ec.bootstrap(executor) with self.assertSendHeadboard() as executor: ec.on_message("NOBODY", executor)
def test_laser(self): with self.get_executor() as executor: ec = HeadController(executor, required_module="LASER", ready_callback=self.raiseException) ec.bootstrap(executor) with self.assertSendHeadboard(PING_CMD) as executor: ec.on_message(HELLO_MSG["LASER"], executor) self.assertRaises(UnittestError, ec.on_message, PONG_MSG, executor) self.assertTrue(ec.ready)
def test_ping_error_after_hello(self): with self.get_executor() as executor: ec = HeadController(executor, required_module="EXTRUDER", ready_callback=self.raiseException) ec.bootstrap(executor) with self.assertSendHeadboard(PING_CMD) as executor: ec.on_message(HELLO_MSG["EXTRUDER"], executor) with self.assertSendHeadboard(PING_CMD) as executor: ec.on_message(ER8_PONG_MSG, executor) with self.assertSendHeadboard() as executor: ec._timer = 0 self.assertRaises(RuntimeError, ec.on_message, ER8_PONG_MSG, executor)
def test_extruder(self): with self.get_executor() as executor: ec = HeadController(executor, required_module="EXTRUDER", ready_callback=self.raiseException) ec.bootstrap(executor) with self.assertSendHeadboard(b"1 PING *33\n") as executor: ec.on_message(HELLO_MSG["EXTRUDER"], executor) with self.assertSendHeadboard(b"1 F:0 S:0 *4\n") as executor: ec.on_message(PONG_MSG, executor) with self.assertSendHeadboard() as executor: self.assertRaises(UnittestError, ec.on_message, "1 OK FAN *92", executor) self.assertTrue(ec.ready) self.assertEqual(ec.module, "EXTRUDER")