def test_record_q(self): # Company cnab = FebrabanCnab(self.branch, self.bank, self.info) record = RecordQ(self.payment, self.info, registry_sequence=1) record.set_cnab(cnab) self.assertEqual( record.as_string(), ('0990001300001Q 012000000000000000Dummy ' ' Mainstreet 138 ' ' Cidade Araci 12345678Los Ange' 'les Ca0000000000000000 ' ' 000 ')) # Individual individual = self.create_individual() self.create_address(person=individual.person) group = self.create_payment_group(payer=individual.person) payment = self.create_payment(date=datetime.date(2012, 7, 14), group=group) record = RecordQ(payment, self.info, registry_sequence=1) record.set_cnab(cnab) self.assertEqual( record.as_string(), ('0990001300001Q 011000000000000000individual ' ' Mainstreet 138 ' ' Cidade Araci 12345678Los Ange' 'les Ca0000000000000000 ' ' 000 '))
def test_record_r(self): cnab = FebrabanCnab(self.branch, self.bank, self.info) record = RecordR(self.payment, self.info, registry_sequence=1) record.set_cnab(cnab) self.assertEquals(record.as_string(), ('0990001300001R 010000000000000000000000000000000' '00000000000000000200000000000000000000000 ' ' ' ' ' ' 0000000000000000 000000000000 0 '))
def test_record_p(self, localnow): localnow.return_value = datetime.datetime(2012, 4, 8, 12, 6) cnab = FebrabanCnab(self.branch, self.bank, self.info) record = RecordP(self.payment, self.info, registry_sequence=1) record.set_cnab(cnab) self.assertEquals(record.as_string(), ('0990001300001P 0101102 000009000150 000000000001' '34 11 2200134 1407201200000000000' '100000000002N14072012100000000000000000000000214' '072012000000000000000000000000000000000000000000' '000 3000000090000000000 '))
def test_as_string(self): cnab = FebrabanCnab(self.branch, self.bank, self.info) cnab.add_record(FooRecord, foo=3) self.assertEqual(cnab.as_string(), '00003\r\n')
def test_total_registries(self): cnab = FebrabanCnab(self.branch, self.bank, self.info) cnab.add_record(FebrabanCnab.FileHeader) cnab.add_record(FebrabanCnab.BatchHeader) cnab.add_record(FooRecord) cnab.add_record(FooRecord) cnab.add_record(FooRecord) bt = cnab.add_record(FebrabanCnab.BatchTrailer) cnab.add_record(FebrabanCnab.FileTrailer) self.assertEqual(bt.total_registries, 4)
def test_total_records(self): cnab = FebrabanCnab(self.branch, self.bank, self.info) self.assertEqual(cnab.total_records, 0) cnab.add_record(FooRecord) self.assertEqual(cnab.total_records, 1)
def test_add_record(self): cnab = FebrabanCnab(self.branch, self.bank, self.info) record = cnab.add_record(FooRecord) self.assertEqual(record.get_value('bank_number'), 99)
def test_get_value(self): cnab = FebrabanCnab(self.branch, self.bank, self.info) cnab.some_property = 84 self.assertEqual(cnab.get_value('some_property'), 84)