vial.test package

Base library for web interface unit tests.

class vial.test.ItemCreateVialTestCase(methodName='runTest')[source]

Bases: vial.test.VialTestCase

Class for testing vial.app.Vial application item creation views.

assertCreate(item_model, url, data, content_checks=None, print_response=False)[source]

Perform attempt to create given item.

maxDiff = None
class vial.test.RegistrationVialTestCase(methodName='runTest')[source]

Bases: vial.test.VialTestCase

Class for testing vial.app.Vial application registration views.

assertRegister(url, data, emails, environ_base=None)[source]
assertRegisterFail(url, data, environ_base=None)[source]
maxDiff = None
user_fixture = {'apikey': None, 'email': 'test.user@domain.org', 'enabled': False, 'fullname': 'Test User', 'id': 5, 'locale': None, 'login': 'test', 'logintime': 'None', 'managements': [], 'memberships': [], 'memberships_wanted': [], 'roles': ['user'], 'timezone': None}
class vial.test.VialTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Class for testing vial.app.Vial application.

assertGetURL(url, status_code=200, content_checks=None, print_response=False)[source]

Perform GET request and check some default assertions against the response.

assertMailbox(checklist)[source]

Check internal mailbox.

assertPostURL(url, data, status_code=200, content_checks=None, print_response=False)[source]

Perform POST request and check some default assertions against the response.

get_fixtures_db(app)[source]
group_enabled(*args, **kwargs)[source]
group_get(*args, **kwargs)[source]
group_id(*args, **kwargs)[source]
group_model()[source]

Get user model class.

group_save(*args, **kwargs)[source]
log_clear()[source]

Clear log content.

log_get()[source]

Get content written to log so far.

logger = <RootLogger root (DEBUG)>
login_dev(login)[source]

Login given user with auth_dev module.

login_env(login, envvar='eppn')[source]

Login given user with auth_env module.

login_pwd(login, password)[source]

Login given user with auth_pwd module.

logout()[source]

Logout current user.

mailbox_clear()[source]

Clear internal mailbox.

mailbox_monitoring(state)[source]

Enable/disable mailbox monitoring.

on_email_sent(message, app)[source]

Signal handler for handling flask_mail.email_dispatched() signal. Log subject and recipients of all emails that have been sent.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

setup_app()[source]

Setup application object.

setup_db()[source]

Perform database setup.

setup_fixtures_db()[source]

Setup general database object fixtures.

setup_logging()[source]

Setup logging configuration for testing purposes.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

teardown_db()[source]
teardown_logging()[source]

Teardown logging configuration for testing purposes.

user_enabled(*args, **kwargs)[source]
user_get(*args, **kwargs)[source]
user_id(*args, **kwargs)[source]
user_model()[source]

Get user model class.

user_save(*args, **kwargs)[source]
vial.test.app_context_wrapper_decorator(func)[source]

Decorator class for conditional wrapping of given function with application context.

class vial.test.do_as_user_decorator(user_name, login_func_name='login_dev', login_func_params=None)[source]

Bases: object

Decorator class for accessing application endpoints as given user.