# Path: burp_reports/__main__.py
# def parse_args(args):
#     """
#     Information extracted from: https://mkaz.com/2014/07/26/python-argparse-cookbook/
#     :return:
#     """
#     parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
#     parser.add_argument('-c', '--reports_conf', dest='reports_conf',
#                         const=os.path.join(os.sep, 'etc', 'burp', 'burp-reports.conf'),
#                         default=None,
#                         nargs='?', help='burp-reports.conf configuration file')
# 
#     parser.add_argument('-ui', '--burpui_apiurl', dest='burpui_apiurl', nargs='?', default=None, const=None,
#                         help='full url to burpui api, like http://user:pass@server:port/api/ \n'
#                              'It is required on cli line or in config file\n\n')
# 
#     # Adding report choices
# 
#     choices_helper = {"print": "Print txt clients list only \n\n",
#                       "outdated": "will print list of outdated clients \n",
#                       "inventory":
#                           'requires -i and -o, check input inventory and generates a comparison\n'
#                           '    Input csv headers required: device name; status; Status (detailed) \n'
#                           '       Example line:            demo1; active; \n'
#                           '                                demo2; active; spare \n'
#                           '     -i email_inventory will download email from imap account set in config',
#                       "email_outdated": "Will send email to configured recipients on config file\n"}
# 
#     parser.add_argument("--report", '-r', dest='report', nargs='?', default='print', const='print',
#                         choices=choices_helper,
#                         help='\n'.join("{}: {}".format(key, value) for key, value in sorted(choices_helper.items())))
# 
#     parser.add_argument('--debug', dest='debug', nargs='?', default=None, const=True,
#                         help='Activate for debugging purposes')
# 
#     parser.add_argument('--version', dest='version', nargs='?', default=None, const=True,
#                         help='Print version and exit')
# 
#     parser.add_argument('--detail', dest='detail', nargs='?', default=None, const=True,
#                         help='Adds more details to reports')
# 
#     parser.add_argument('--ping', dest='ping', nargs='?', default=None, const=True,
#                         help='Adds ping check to outdated report only')
# 
#     parser.add_argument('--write_config', dest='write_config', default=None, action='store_true',
#                         help="Write configuration with default values, useful to get a config file to modify")
# 
#     parser.add_argument('-i', nargs='?', default=None, help='Input csv file to use on --report inventory \n'
#                                                             '(also can be an url to download it)\n')
#     parser.add_argument('-o', nargs='?', default=None, help='Output csv file to use on --report inventory')
# 
#     if not args:
#         raise SystemExit(parser.print_help())
# 
#     return parser.parse_args(args)


from ..__main__ import parse_args
import pytest


class TestParser:

    def test_noargs(self):
        """
        User passes no args, should fail with SystemExit
        """
        with pytest.raises(SystemExit):
            options = parse_args([])

    def test_ui_dummy(self):
        """
        -ui dummy must be tested

        :return argparse dict with options and burpui_apiurl = dummy
        """

# Path: burp_reports/__main__.py
# def parse_args(args):
#     """
#     Information extracted from: https://mkaz.com/2014/07/26/python-argparse-cookbook/
#     :return:
#     """
#     parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
#     parser.add_argument('-c', '--reports_conf', dest='reports_conf',
#                         const=os.path.join(os.sep, 'etc', 'burp', 'burp-reports.conf'),
#                         default=None,
#                         nargs='?', help='burp-reports.conf configuration file')
# 
#     parser.add_argument('-ui', '--burpui_apiurl', dest='burpui_apiurl', nargs='?', default=None, const=None,
#                         help='full url to burpui api, like http://user:pass@server:port/api/ \n'
#                              'It is required on cli line or in config file\n\n')
# 
#     # Adding report choices
# 
#     choices_helper = {"print": "Print txt clients list only \n\n",
#                       "outdated": "will print list of outdated clients \n",
#                       "inventory":
#                           'requires -i and -o, check input inventory and generates a comparison\n'
#                           '    Input csv headers required: device name; status; Status (detailed) \n'
#                           '       Example line:            demo1; active; \n'
#                           '                                demo2; active; spare \n'
#                           '     -i email_inventory will download email from imap account set in config',
#                       "email_outdated": "Will send email to configured recipients on config file\n"}
# 
#     parser.add_argument("--report", '-r', dest='report', nargs='?', default='print', const='print',
#                         choices=choices_helper,
#                         help='\n'.join("{}: {}".format(key, value) for key, value in sorted(choices_helper.items())))
# 
#     parser.add_argument('--debug', dest='debug', nargs='?', default=None, const=True,
#                         help='Activate for debugging purposes')
# 
#     parser.add_argument('--version', dest='version', nargs='?', default=None, const=True,
#                         help='Print version and exit')
# 
#     parser.add_argument('--detail', dest='detail', nargs='?', default=None, const=True,
#                         help='Adds more details to reports')
# 
#     parser.add_argument('--ping', dest='ping', nargs='?', default=None, const=True,
#                         help='Adds ping check to outdated report only')
# 
#     parser.add_argument('--write_config', dest='write_config', default=None, action='store_true',
#                         help="Write configuration with default values, useful to get a config file to modify")
# 
#     parser.add_argument('-i', nargs='?', default=None, help='Input csv file to use on --report inventory \n'
#                                                             '(also can be an url to download it)\n')
#     parser.add_argument('-o', nargs='?', default=None, help='Output csv file to use on --report inventory')
# 
#     if not args:
#         raise SystemExit(parser.print_help())
# 
#     return parser.parse_args(args)


# Path: burp_reports/tests/test_parser.py
from ..__main__ import parse_args
import pytest



class TestParser:

    def test_noargs(self):
        """
        User passes no args, should fail with SystemExit
        """
        with pytest.raises(SystemExit):
            options = parse_args([])

    def test_ui_dummy(self):
        """
        -ui dummy must be tested

        :return argparse dict with options and burpui_apiurl = dummy
        """

        options = parse_args(['-ui', 'dummy'])