def test_should_return_stable_value_when_stable_property_is_called(self): # GIVEN stable = any_stable() lowpan_id = network_data.LowpanId(any_c(), any_cid(), any_context_length(), stable) # WHEN actual_stable = lowpan_id.stable # THEN self.assertEqual(stable, actual_stable)
def test_should_return_context_length_value_when_context_length_property_is_called(self): # GIVEN context_length = any_context_length() lowpan_id = network_data.LowpanId(any_c(), any_cid(), context_length, any_stable()) # WHEN actual_context_length = lowpan_id.context_length # THEN self.assertEqual(context_length, actual_context_length)
def test_should_create_LowpanId_from_bytearray_when_parse_method_is_called(self): # GIVEN c = any_c() cid = any_cid() context_length = any_context_length() stable = any_stable() factory = network_data.LowpanIdFactory() data = convert_lowpan_id_to_bytearray(network_data.LowpanId(c, cid, context_length, stable)) message_info = common.MessageInfo() message_info.stable = stable # WHEN actual_lowpan_id = factory.parse(io.BytesIO(data), message_info) # THEN self.assertTrue(isinstance(actual_lowpan_id, network_data.LowpanId)) self.assertEqual(c, actual_lowpan_id.c) self.assertEqual(cid, actual_lowpan_id.cid) self.assertEqual(context_length, actual_lowpan_id.context_length)
def any_lowpan_id(): return network_data.LowpanId(any_c(), any_cid(), any_context_length(), any_stable())