def test_from_dict(self):
     some_dict = {
             'net_key':'some_net_key',
             'operation_id':999,
             'color':888,
             }
     operation_data = OperationData.from_dict(some_dict)
     self.assertEqual(self.operation_data, operation_data)
Example #2
0
    def _get_message_dict(self, message):
        message_dict = message.to_dict()

        message_dict['status'] = Status(message_dict['status'])

        OPERATION_DATA_FIELDS = ['operation_data', 'parent_operation_data',
                'peer_operation_data']
        for field in OPERATION_DATA_FIELDS:
            if field in message_dict:
                message_dict[field] = OperationData.from_dict(
                        message_dict[field])

        return message_dict