48 lines
2.2 KiB
Python
48 lines
2.2 KiB
Python
import os
|
|
import time
|
|
|
|
import click
|
|
|
|
from sdi_checker.libs.sdi_consistence_check.check import Check
|
|
|
|
|
|
@click.command(name='test')
|
|
@click.argument('url', nargs=-1) # help = the server to target (full URL, e.g. https://sdi.georchestra.org/geoserver/wms)
|
|
@click.option('--check-layers', '-l', is_flag=True, type=bool, help="check WMS/WFS layer validity")
|
|
@click.option('--disable-ssl-verification', '-ssl', is_flag=True, type=bool, help="disable certificate verification")
|
|
@click.option('--only-err', '-e', is_flag=True, type=bool, help="only display errors, no summary informations will be displayed")
|
|
@click.option('--xunit', '-x', is_flag=True, type=bool, help="generate a XML xunit result report")
|
|
@click.option('--xunit-output', '-xo', default="xunit.xml", show_default=True, type=str, help="name of the xunit report file, defaults to ./xunit.xml")
|
|
@click.option('--log-to-file', '-l', default='', type=str, help="if a file path is specified, log output to this file, not stdout")
|
|
@click.option('--timeout', '-t', default=30, type=int, help="specify a timeout for request to external service.")
|
|
@click.option('--output', '-o', type=click.Choice(['json', 'txt', 'screen', 'csv', 'db'], case_sensitive=False), default='screen', help="output format")
|
|
@click.pass_obj
|
|
def run(app, url, check_layers, disable_ssl_verification, only_err, xunit, xunit_output, log_to_file, timeout, output):
|
|
"""
|
|
> master add [TEXT] [--template TPL] [--file FILE] [--edit] [--repository REPOSITORY] [--login LOGIN] [--password PASSWORD]
|
|
"""
|
|
|
|
# Utiliser fonction commune à WFS et WMS
|
|
on_test(app, url, check_layers, disable_ssl_verification, only_err, xunit, xunit_output, log_to_file, timeout, output)
|
|
|
|
|
|
|
|
def on_test(app, url, check_layers, disable_ssl_verification, only_err, xunit, xunit_output, log_to_file, timeout, output):
|
|
"""
|
|
> master add [TEXT] [--template TPL] [--file FILE] [--edit] (=> open edit window)
|
|
"""
|
|
|
|
mode = 'wms'
|
|
server = 'https://www.datagrandest.fr/geoserver/araa/ows'
|
|
|
|
check = Check(mode=mode, server=server, logs=app.logs)
|
|
check.run()
|
|
|
|
print(check.logs.text())
|
|
|
|
# check = Check().init(mode=mode, server=server).run()
|
|
|
|
# check = Check().run(mode=mode, server=server)
|
|
|
|
# check = Check()
|
|
# check.run(mode=mode, server=server) |