Coverage for jbank/management/commands/test_xp.py: 50%

# Coverage for jbank/management/commands/test_xp.py : 50%

## 16 statements

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 from django.core.management.base import CommandParser

2 from jbank.files import list_dir_files

3 from jbank.sepa import Pain002

4 from jutil.command import SafeCommand

5

6

7 class Command(SafeCommand):

8 help = 'Parses pain.002 payment response .XP files'

9

10 def add_arguments(self, parser: CommandParser):

11 parser.add_argument('path', type=str)

12 parser.add_argument('--all', action='store_true')

13

14 def do(self, *args, **options):

15 files = list_dir_files(options['path'], '.XP')

16 for f in files:

17 print(f)

18 with open(f, 'rb') as fp:

19 p = Pain002(fp.read())

20 print(p) # pytype: disable=not-callable