コード例 #1
0
ファイル: test_sushi.py プロジェクト: pitthsls/pycounter
 def test_dump(self, mock_logger):
     with HTTMock(sushi_mock):
         sushi.get_report(
             "http://www.example.com/Sushi",
             datetime.date(2015, 1, 1),
             datetime.date(2015, 1, 31),
             sushi_dump=True,
         )
     self.assertTrue(mock_logger.debug.called)
コード例 #2
0
 def test_dump(self, mock_logger):
     with HTTMock(sushi_mock):
         sushi.get_report(
             "http://www.example.com/Sushi",
             datetime.date(2015, 1, 1),
             datetime.date(2015, 1, 31),
             sushi_dump=True,
         )
     self.assertTrue(mock_logger.debug.called)
コード例 #3
0
ファイル: test_sushi.py プロジェクト: pitthsls/pycounter
 def setUp(self):
     with HTTMock(sushi_mock):
         self.report = sushi.get_report(
             "http://www.example.com/Sushi",
             datetime.date(2015, 1, 1),
             datetime.date(2015, 1, 31),
         )
コード例 #4
0
 def setUp(self):
     with HTTMock(sushi_mock):
         self.report = sushi.get_report(
             "http://www.example.com/Sushi",
             datetime.date(2015, 1, 1),
             datetime.date(2015, 1, 31),
         )
コード例 #5
0
def main(url, report, release, start_date, end_date, requestor_id,
         requestor_email, requestor_name, customer_name, customer_reference,
         format_, output_file):
    click.echo("pycounter SUSHI client for URL %s (%s R%s)" %
               (url, report, release))
    if end_date is not None and start_date is None:
        click.echo('Cannot specify --end_date without --start_date', err=True)
        sys.exit(1)
    if start_date is None:
        converted_start_date = prev_month(datetime.datetime.now())
    else:
        converted_start_date = convert_date_run(start_date)
    if end_date is None:
        converted_end_date = last_day(converted_start_date)
    else:
        converted_end_date = convert_date_run(end_date)
    report = sushi.get_report(wsdl_url=url,
                              report=report,
                              release=release,
                              requestor_id=requestor_id,
                              requestor_name=requestor_name,
                              requestor_email=requestor_email,
                              customer_reference=customer_reference,
                              customer_name=customer_name,
                              start_date=converted_start_date,
                              end_date=converted_end_date)
    output_file = output_file % format_
    report.write_to_file(output_file, format_)
コード例 #6
0
ファイル: sushiclient.py プロジェクト: chill17/pycounter
def main(url, report, release, start_date, end_date, requestor_id,
         requestor_email, requestor_name, customer_name,
         customer_reference, format_, output_file):
    click.echo("pycounter SUSHI client for URL %s (%s R%s)"
               % (url, report, release))
    if end_date is not None and start_date is None:
        click.echo('Cannot specify --end_date without --start_date',
                   err=True)
        sys.exit(1)
    if start_date is None:
        converted_start_date = prev_month(datetime.datetime.now())
    else:
        converted_start_date = convert_date_run(start_date)
    if end_date is None:
        converted_end_date = last_day(converted_start_date)
    else:
        converted_end_date = convert_date_run(end_date)
    report = sushi.get_report(wsdl_url=url,
                              report=report,
                              release=release,
                              requestor_id=requestor_id,
                              requestor_name=requestor_name,
                              requestor_email=requestor_email,
                              customer_reference=customer_reference,
                              customer_name=customer_name,
                              start_date=converted_start_date,
                              end_date=converted_end_date)
    output_file = output_file % format_
    report.write_to_file(output_file, format_)
コード例 #7
0
ファイル: sushiclient.py プロジェクト: yannsta/pycounter
def main(
    url,
    report,
    release,
    start_date,
    end_date,
    requestor_id,
    requestor_email,
    requestor_name,
    customer_name,
    customer_reference,
    api_key,
    format_,
    output_file,
    dump,
    no_ssl_verify,
    no_delay,
):
    """Main function for the SUSHI client."""
    # pylint: disable=too-many-locals
    click.echo(f"pycounter SUSHI client for URL {url} ({report} R{release})")
    if end_date is not None and start_date is None:
        click.echo("Cannot specify --end_date without --start_date", err=True)
        sys.exit(1)
    if start_date is None:
        converted_start_date = prev_month(datetime.datetime.now())
    else:
        converted_start_date = convert_date_run(start_date)
    if end_date is None:
        converted_end_date = last_day(converted_start_date)
    else:
        converted_end_date = convert_date_run(end_date)
    report = sushi.get_report(
        wsdl_url=url,
        report=report,
        release=release,
        requestor_id=requestor_id,
        requestor_name=requestor_name,
        requestor_email=requestor_email,
        customer_reference=customer_reference,
        customer_name=customer_name,
        start_date=converted_start_date,
        end_date=converted_end_date,
        sushi_dump=dump,
        no_delay=no_delay,
        verify=not no_ssl_verify,
        api_key=api_key,
    )
    if "%s" in output_file:
        output_file = output_file % format_
    report.write_to_file(output_file, format_)
コード例 #8
0
ファイル: sushiclient.py プロジェクト: pitthsls/pycounter
def main(
    url,
    report,
    release,
    start_date,
    end_date,
    requestor_id,
    requestor_email,
    requestor_name,
    customer_name,
    customer_reference,
    format_,
    output_file,
    dump,
    no_ssl_verify,
    no_delay,
):
    """Main function for the SUSHI client."""
    click.echo("pycounter SUSHI client for URL %s (%s R%s)" % (url, report, release))
    if end_date is not None and start_date is None:
        click.echo("Cannot specify --end_date without --start_date", err=True)
        sys.exit(1)
    if start_date is None:
        converted_start_date = prev_month(datetime.datetime.now())
    else:
        converted_start_date = convert_date_run(start_date)
    if end_date is None:
        converted_end_date = last_day(converted_start_date)
    else:
        converted_end_date = convert_date_run(end_date)
    report = sushi.get_report(
        wsdl_url=url,
        report=report,
        release=release,
        requestor_id=requestor_id,
        requestor_name=requestor_name,
        requestor_email=requestor_email,
        customer_reference=customer_reference,
        customer_name=customer_name,
        start_date=converted_start_date,
        end_date=converted_end_date,
        sushi_dump=dump,
        no_delay=no_delay,
        verify=not no_ssl_verify,
    )
    if "%s" in output_file:
        output_file = output_file % format_
    report.write_to_file(output_file, format_)