The lookupproxy project

The lookupproxy project contains top-level configuration and URL routes for the entire web application.

Extensions to drf-yasg

This project overrides the drf-yasg/swagger-ui.html template provided by drf-yasg. The default template does not provided the degree of customisation needed for this project. Most notably, the OAuth2 redirect URL could not be customised. We ship a lightly modified version of the template for our needs along with some custom initialisation JavaScript as a static file. We also include the oauth2-redirect.html file which ships with the Swagger UI so that the OAuth2 flow works.

Settings

The lookupproxy project ships a number of settings files.

Generic settings

The default lookupproxy.settings module contains settings which are common to most deployment environments.

Test-suite specific settings

The lookupproxy.settings_testsuite module contains settings which are specific to the test suite environment. The default tox test environment uses this settings module when running the test suite.

lookupproxy.settings.tox.TEST_RUNNER = 'lookupproxy.test.runner.BufferedDiscoverRunner'

The default test runner is changed to one which captures stdout and stderr when running tests.

lookupproxy.settings.tox.STATIC_ROOT = '/home/travis/build/uisautomation/lookupproxy/build/static'

Static files are collected into a directory determined by the tox configuration. See the tox.ini file.

Developer specific settings

Custom test suite runner

The test suite settings overrides the TEST_RUNNER setting to point to BufferedTextTestRunner. This runner captures output to stdout and stderr and only reports the output if a test fails. This helps make our tests a little less noisy.

class lookupproxy.test.runner.BufferedDiscoverRunner(pattern=None, top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_mode=False, debug_sql=False, parallel=0, tags=None, exclude_tags=None, **kwargs)

A sub-class of django.test.runner.DiscoverRunner which has exactly the same behaviour except that the test_runner attribute is set to BufferedTextTestRunner.

The upshot of this is that output to stdout and stderror is captured and only reported on test failure.

class lookupproxy.test.runner.BufferedTextTestRunner(stream=None, descriptions=True, verbosity=1, failfast=False, buffer=True, resultclass=None, warnings=None, *, tb_locals=False, **kwargs)

A sub-class of unittest.TextTestRunner with identical behaviour except that the buffer keyword argument to the constructor defaults to True.