The horizon.test.helpers Module¶
- class horizon.test.helpers.JasmineTests(methodName='runTest')[source]
Bases: horizon.test.helpers.SeleniumTestCase
Helper class which allows you to create a simple Jasmine test running through Selenium
To run a jasmine test suite create a class which extends JasmineTests in the horizon/test/jasmine/jasmine_tests.py and define two class attributes
- sources¶
A list of of JS source files (the {{STATIC_URL}} will be added automatically, these are the source files tested
- specs¶
A list of of Jasmine JS spec files (the {{STATIC_URL}} will be added automatically
- template_name¶
A template which will contain the html needed by the test, this attribute is optional, if it is not specified the default template will be used. The template, if specified, must extends horizon/jasmine/jasmine.html and insert the html in a block which name must be content
- run_jasmine()[source]
- sources = []
- specs = []
- template_name = None
- test()[source]
- class horizon.test.helpers.RequestFactoryWithMessages(**defaults)[source]
Bases: django.test.client.RequestFactory
- get(*args, **kwargs)[source]
- post(*args, **kwargs)[source]
- class horizon.test.helpers.SeleniumTestCase(methodName='runTest')[source]
Bases: django.test.testcases.LiveServerTestCase
- setUp()[source]
- classmethod setUpClass()[source]
- classmethod tearDownClass()[source]
- class horizon.test.helpers.TestCase(methodName='runTest')[source]
Bases: django.test.testcases.TestCase
Specialized base test case class for Horizon which gives access to numerous additional features:
- The mox mocking framework via self.mox.
- A RequestFactory class which supports Django’s contrib.messages framework via self.factory.
- A ready-to-go request object via self.request.
- assertMessageCount(response=None, **kwargs)[source]
Asserts that the specified number of messages have been attached for various message types. Usage would look like self.assertMessageCount(success=1).
- assertNoMessages(response=None)[source]
Asserts that no messages have been attached by the contrib.messages framework.
- setUp()[source]
- set_permissions(permissions=None)[source]
- tearDown()[source]