How to use the gabbi.driver function in gabbi

To help you get started, we’ve selected a few gabbi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / heat / heat_integrationtests / api / test_heat_api.py View on Github external
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)

    conf = config.CONF.heat_plugin
    if conf.auth_url is None:
        # It's not configured, let's not load tests
        return
    manager = clients.ClientManager(conf)
    endpoint = manager.identity_client.get_endpoint_url(
        'orchestration', conf.region)
    host = urlparse.urlparse(endpoint).hostname
    os.environ['OS_TOKEN'] = manager.identity_client.auth_token
    os.environ['PREFIX'] = test.rand_name('api')

    return driver.build_tests(test_dir, loader, host=host,
                              url=endpoint, test_loader_name=__name__)
github cdent / gabbi / gabbi / test_intercept.py View on Github external
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    # Set and environment variable for one of the tests.
    os.environ['GABBI_TEST_URL'] = 'takingnames'
    prefix = os.environ.get('GABBI_PREFIX')
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host=None,
                              intercept=simple_wsgi.SimpleWsgi,
                              prefix=prefix,
                              fixture_module=sys.modules[__name__],
                              response_handlers=[TestResponseHandler])
github cdent / gabbi / gabbi / test_live.py View on Github external
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host='google.com', port=443)
github cdent / gabbi / docs / source / pytest-example.py View on Github external
def test_gabbits():
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    # Pass "require_ssl=True" as an argument to force all tests
    # to use SSL in requests.
    test_generator = driver.py_test_generator(
        test_dir, intercept=wsgiapp.app,
        fixture_module=fixtures)

    for test in test_generator:
        yield test
github cdent / gabbi / docs / source / example.py View on Github external
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    # Pass "require_ssl=True" as an argument to force all tests
    # to use SSL in requests.
    return driver.build_tests(test_dir, loader,
                              intercept=wsgiapp.app,
                              fixture_module=fixtures)