def test_get_lines_status_changes(self): # uncleared -> pending lines = ('2016/10/24 abc', ' e: xyz', ' a: smurg $-25') thing = LedgerThing(list(lines), 'smurg') thing.rec_status = LedgerThing.REC_PENDING self.assertEqual( ('2016/10/24 abc', ' e: xyz', ' ! a: smurg $-25'), tuple(thing.get_lines()) ) # pending -> cleared thing.rec_status = LedgerThing.REC_CLEARED self.assertEqual( ('2016/10/24 abc', ' e: xyz', ' * a: smurg $-25'), tuple(thing.get_lines()) ) # cleared -> uncleared thing.rec_status = LedgerThing.REC_UNCLEARED self.assertEqual( ('2016/10/24 abc', ' e: xyz', ' a: smurg $-25'), tuple(thing.get_lines()) )
def test_get_lines_status_change_multiple_lines(self): lines = ( '2016/10/24 glob', ' ; might as well test comment handling, too', ' e: blurg $50', ' a: smurg', ' a: smurg $-25', ) thing = LedgerThing(list(lines), 'smurg') thing.rec_status = LedgerThing.REC_PENDING expected = ( '2016/10/24 glob', ' ; might as well test comment handling, too', ' e: blurg $50', ' ! a: smurg', ' ! a: smurg $-25', ) self.assertEqual( expected, tuple(thing.get_lines()) ) self.assertEqual('', self.redirect.getvalue().rstrip())