AKModel.tests module

class AKModel.tests.BasicViewTests[source]

Bases: object

Parent class for “standard” tests of views

Provided with a list of views and arguments (if necessary), this will test that views - render correctly without errors - are only reachable with the correct rights (neither too freely nor too restricted)

To do this, the test creates sample users, fixtures are loaded automatically by the django test framework. It also provides helper functions, e.g., to check for correct messages to the user or more simply generate the URLs to test

In this class, methods from TestCase will be called at multiple places event though TestCase is not a parent of this class but has to be included as parent in concrete implementations of this class seperately. It however still makes sense to treat this class as some kind of mixin and not implement it as a child of TestCase, since the test framework does not understand the concept of abstract test definitions and would handle this class as real test case otherwise, distorting the test results.

setUp()[source]

Setup testing by creating sample users

test_views_for_200()[source]

Test the list of public views (as specified in “VIEWS”) for error-free rendering

test_access_control_staff_only()[source]

Test whether internal views (as specified in “VIEWS_STAFF_ONLY” are visible to staff users and staff users only

test_submit_edit_form()[source]

Test edit forms (as specified in “EDIT_TESTCASES”) in the most simple way (sending them again unchanged)

class AKModel.tests.ModelViewTests(methodName='runTest')[source]

Bases: BasicViewTests, TestCase

Basic view test cases for views from AKModel plus some custom tests

test_admin()[source]

Test basic admin functionality (displaying and interacting with model instances)

test_wiki_export()[source]

Test wiki export This will test whether the view renders at all and whether the export list contains the correct AKs