예제 #1
0
 def _get_message(self):
     return MessageRecord(record_type='MSG',
                          transaction_sequence_n=3,
                          record_sequence_n=15,
                          message_level='F',
                          validation_n='AB3',
                          message_type='G',
                          message_text='THE MESSAGE',
                          original_record_sequence_n=124,
                          message_record_type='AGR')
예제 #2
0
 def decode(self, data):
     return MessageRecord(
         record_type=data['record_type'],
         transaction_sequence_n=data['transaction_sequence_n'],
         record_sequence_n=data['record_sequence_n'],
         message_type=data['message_type'],
         message_text=data['message_text'],
         original_record_sequence_n=data['original_record_sequence_n'],
         message_record_type=data['message_record_type'],
         message_level=data['message_level'],
         validation_n=data['validation_n'])
예제 #3
0
    def test_encoded(self):
        data = MessageRecord(record_type='MSG',
                             transaction_sequence_n=3,
                             record_sequence_n=15,
                             message_level='F',
                             validation_n='AB3',
                             message_type='G',
                             message_text='THE MESSAGE',
                             original_record_sequence_n=124,
                             message_record_type='AGR')

        encoded = self._encoder.encode(data)

        self.assertEqual('MSG', encoded['record_type'])
        self.assertEqual(3, encoded['transaction_sequence_n'])
        self.assertEqual(15, encoded['record_sequence_n'])
        self.assertEqual('F', encoded['message_level'])
        self.assertEqual('AB3', encoded['validation_n'])
        self.assertEqual('G', encoded['message_type'])
        self.assertEqual('THE MESSAGE', encoded['message_text'])
        self.assertEqual(124, encoded['original_record_sequence_n'])
        self.assertEqual('AGR', encoded['message_record_type'])