def _test_bad_param(self): with self.assertRaises(ValueError): self.udsclient.link_control(control_type='x') with self.assertRaises(ValueError): self.udsclient.link_control(control_type=0x80) with self.assertRaises(ValueError): self.udsclient.link_control(control_type=1) # Missing Baudrate with self.assertRaises(ValueError): self.udsclient.link_control(control_type=2) # Missing Baudrate with self.assertRaises(ValueError): self.udsclient.link_control( control_type=0, baudrate=Baudrate(500000)) # Baudrate is not needed with self.assertRaises(ValueError): self.udsclient.link_control( control_type=1, baudrate=1) # Baudrate should be Baudrate instance with self.assertRaises(ValueError): self.udsclient.link_control( control_type=1, baudrate='x') # Baudrate should be Baudrate instance
def _test_linkcontrol_verify_fixed(self): baudrate = Baudrate(250000, baudtype=Baudrate.Type.Fixed) response = self.udsclient.link_control(control_type=1, baudrate=baudrate) self.assertTrue(response.valid) self.assertTrue(response.positive) self.assertEqual(response.service_data.control_type_echo, 1)
def _test_linkcontrol_verify_fixed_spr(self): baudrate = Baudrate(250000, baudtype=Baudrate.Type.Fixed) with self.udsclient.suppress_positive_response: response = self.udsclient.link_control(control_type=1, baudrate=baudrate) self.assertEqual(response, None) self.conn.fromuserqueue.get( timeout=0.2) #Avoid closing connection prematurely