portal_web.tests package

Subpackages

Submodules

portal_web.tests.conftest module

Pytest Fixtures

class portal_web.tests.conftest.BrowserHelper(gui, api, screenshots=True, screenshot_path='/shared/tests/screenshots')[source]

Bases: object

Browser helper for use in selenium tests with pytest.

Notes: - undefined attributes of this class will be requested from self.browser - urls starting with “/” or “gui/” will send requests to the the webgui

service and “api/” to the webapi service.

browser

remote webdriver

Type:

webdriver.Remote

options

options used for the webdriver

Type:

webdriver.Options

host

hostname/ip to remote access the app

Type:

str

gui

webgui app

Type:

webtest.http.StopableWSGIServer

api

webapi app

Type:

webtest.http.StopableWSGIServer

screenshots

create screenshots during a test run

Type:

bool

screenshot_path

directory for screenshots

Type:

str

get()[source]

overrides browser.get to autocomplete the url and automate

get(url, *args, **kwargs)[source]

Overrides browser.get to autocomplete the url and automate screenshot handling. urls starting with “/” or “gui/” will send requests to the the webgui service and “api/” to the webapi service.

screenshot(name='')[source]

Takes a screenshot of the current browser client viewport.

class portal_web.tests.conftest.PyramidHelper(settings)[source]

Bases: object

Pyramid helper for use in pytests.

settings

parsed pyramid ini config

Type:

paste.deploy.config

request

empty dummy request

Type:

pyramid.testing.DummyRequest

resource

empty dummy resource

Type:

pyramid.testing.DummyResource

config

pyramid app config

Type:

pyramid.config.Configurator

registry

pyramid registry

Type:

pyramid.registry.Registry

class portal_web.tests.conftest.TrytonHelper(settings)[source]

Bases: object

Tryton helper for use in pytests.

settings

parsed pyramid ini config

Type:

paste.deploy.config

Tdb

Tdb class

Type:

Tdb

pool

Initialized pool

Type:

Pool

transaction()

Tdb transaction decorator

delete_records()[source]

helper function to delete records in reversed order

static delete_records(records)[source]
portal_web.tests.conftest.api(settings)[source]

Sets up an webapi service with TestApp.

Returns:

for functional tests with webtest

Return type:

webtest.TestApp

portal_web.tests.conftest.browser(browser_gui, browser_api)[source]

Provides the selenoum test browser.

Yields:

BrowserHelper

selenium remote connection to selenium hub service with

additional helper functions

portal_web.tests.conftest.browser_api(settings)[source]

Sets up an webapi service with StopableWSGIServer.

Yields:

webtest.http.StopableWSGIServer – for integration tests with selenium

portal_web.tests.conftest.browser_gui(settings)[source]

Sets up a webgui service with StopableWSGIServer.

Yields:

webtest.http.StopableWSGIServer – for integration tests with selenium

portal_web.tests.conftest.create_party(tryton)[source]

Yields a function to create a party.

portal_web.tests.conftest.create_web_user(tryton)[source]

Yields a function to create a web user.

portal_web.tests.conftest.debug(caplog)[source]
portal_web.tests.conftest.delete_screenshots()[source]

Deletes all screenshots of previous selenium tests.

portal_web.tests.conftest.dummy_request()[source]

Creates an empty dummy request.

Returns:

dummy request

Return type:

pyramid.testing.DummyRequest

portal_web.tests.conftest.dummy_resource()[source]

Creates an empty dummy resource.

Returns:

dummy resource

Return type:

pyramid.testing.DummyResource

portal_web.tests.conftest.gui(settings)[source]

Sets up a webgui service with TestApp.

Returns:

for functional tests with webtest

Return type:

webtest.TestApp

portal_web.tests.conftest.pyramid(settings)[source]

Provides the pyramid helper class.

Yields:

PyramidHelper – Helper with usual pyramid testing objects accessible

portal_web.tests.conftest.pytest_collection_modifyitems(session, config, items)[source]

Fixes the nodid path string to show the full path.

portal_web.tests.conftest.request_with_registry(settings)[source]

Creates a request with registry set up.

Returns:

dummy request

Return type:

pyramid.testing.DummyRequest

portal_web.tests.conftest.reset(request)[source]

Resets the session.

portal_web.tests.conftest.reset_database()[source]

Resets the database for each test run.

portal_web.tests.conftest.settings()[source]

Provides parsed pyramid settings (plugins combined, envvars substituted).

portal_web.tests.conftest.tryton(settings)[source]

Provides the tryton test helper class.

Yields:

TrytonHelper – Helper with usual tryton testing objects accessible

Module contents