(options)
Run GeoNode's Integration test suite against the external apps
Run GeoNode's Integration test suite against the external apps
Run GeoNode s Integration test suite against the external apps
def test_integration(options):
    """
    Run GeoNode's Integration test suite against the external apps
    """
    prefix = options.get('prefix')
    local = str2bool(options.get('local', 'false'))
    if local:
        call_task('stop_geoserver')
        _reset()

    name = options.get('name', None)
    settings = options.get('settings', '')
    success = False
    try:
        call_task('setup', options={'settings': settings, 'force_exec': True})

        if not settings:
            settings = 'REUSE_DB=1 DJANGO_SETTINGS_MODULE=geonode.settings'

        if name and name in ('geonode.tests.csw', 'geonode.tests.integration', 'geonode.geoserver.tests.integration'):
            call_task('sync', options={'settings': settings})
            if local:
                call_task('start_geoserver', options={'settings': settings, 'force_exec': True})
                call_task('start', options={'settings': settings})
            if integration_server_tests:
                call_task('setup_data', options={'settings': settings})
        elif 'geonode.geoserver' in INSTALLED_APPS:
            if local:
                sh("cp geonode/upload/tests/test_settings.py geonode/")
                settings = 'geonode.test_settings'
                sh(f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py "
                   "makemigrations --noinput")
                sh(f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py "
                   "migrate --noinput")
                sh(f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py "
                   "loaddata sample_admin.json")
                sh(f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py "
                   "loaddata geonode/base/fixtures/default_oauth_apps.json")
                sh(f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py "
                   "loaddata geonode/base/fixtures/initial_data.json")
                call_task('start_geoserver')
                bind = options.get('bind', '0.0.0.0:8000')
                foreground = '' if options.get('foreground', False) else '&'
                sh(f'DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py runmessaging {foreground}')
                sh(f'DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py runserver {bind} {foreground}')
                sh('sleep 30')
                settings = f'REUSE_DB=1 DJANGO_SETTINGS_MODULE={settings}'
            else:
                call_task('sync', options={'settings': settings})

        live_server_option = ''
        info("Running the tests now...")
        sh(f'{settings} {prefix} manage.py test {name} -v 3 {_keepdb} --noinput {live_server_option}')

    except BuildFailure as e:
        info(f'Tests failed! {str(e)}')
    else:
        success = True
    finally:
        if local:
            stop(options)
            _reset()

    if not success:
        sys.exit(1)
def test_integration ( options ) : prefix = options . get ( 'prefix' ) local = str2bool ( options . get ( 'local' , 'false' ) ) if local : call_task ( 'stop_geoserver' ) _reset ( ) name = options . get ( 'name' , None ) settings = options . get ( 'settings' , '' ) success = False try : call_task ( 'setup' , options = { 'settings' : settings , 'force_exec' : True } ) if not settings : settings = 'REUSE_DB=1 DJANGO_SETTINGS_MODULE=geonode.settings' if name and name in ( 'geonode.tests.csw' , 'geonode.tests.integration' , 'geonode.geoserver.tests.integration' ) : call_task ( 'sync' , options = { 'settings' : settings } ) if local : call_task ( 'start_geoserver' , options = { 'settings' : settings , 'force_exec' : True } ) call_task ( 'start' , options = { 'settings' : settings } ) if integration_server_tests : call_task ( 'setup_data' , options = { 'settings' : settings } ) elif 'geonode.geoserver' in INSTALLED_APPS : if local : sh ( "cp geonode/upload/tests/test_settings.py geonode/" ) settings = 'geonode.test_settings' sh ( f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py " "makemigrations --noinput" ) sh ( f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py " "migrate --noinput" ) sh ( f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py " "loaddata sample_admin.json" ) sh ( f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py " "loaddata geonode/base/fixtures/default_oauth_apps.json" ) sh ( f"DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py " "loaddata geonode/base/fixtures/initial_data.json" ) call_task ( 'start_geoserver' ) bind = options . get ( 'bind' , '0.0.0.0:8000' ) foreground = '' if options . get ( 'foreground' , False ) else '&' sh ( f'DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py runmessaging {foreground}' ) sh ( f'DJANGO_SETTINGS_MODULE={settings} python -W ignore manage.py runserver {bind} {foreground}' ) sh ( 'sleep 30' ) settings = f'REUSE_DB=1 DJANGO_SETTINGS_MODULE={settings}' else : call_task ( 'sync' , options = { 'settings' : settings } ) live_server_option = '' info ( "Running the tests now..." ) sh ( f'{settings} {prefix} manage.py test {name} -v 3 {_keepdb} --noinput {live_server_option}' ) except BuildFailure as e : info ( f'Tests failed! {str(e)}' ) else : success = True finally : if local : stop ( options ) _reset ( ) if not success : sys . exit ( 1 )