Horizon TestCase Classes

Horizon TestCase Classes

Horizon provides a base test case class which provides several useful pre-prepared attributes for testing Horizon components.

class horizon.test.helpers.TestCase(methodName='runTest')[source]

Base test case class for Horizon with 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 expected number of messages have been attached.

The expected number of messages can be specified per message type. Usage would look like self.assertMessageCount(success=1).

assertNoMessages(response=None)[source]

Asserts no messages have been attached by the messages framework.

The expected messages framework is django.contrib.messages.

The OpenStack Dashboard also provides test case classes for greater ease-of-use when testing APIs and OpenStack-specific auth scenarios.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.