:orphan: :py:mod:`oioioi.base.tests` =========================== .. py:module:: oioioi.base.tests Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 pytest_plugin/index.rst test_dotted_field_classes/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.base.tests._AssertNumQueriesLessThanContext oioioi.base.tests.TestCase oioioi.base.tests.IgnorePasswordAuthBackend oioioi.base.tests.FakeTimeMiddleware oioioi.base.tests.TestsUtilsMixin Functions ~~~~~~~~~ .. autoapisummary:: oioioi.base.tests.fake_time oioioi.base.tests.fake_timezone_now oioioi.base.tests.get_url oioioi.base.tests.check_not_accessible oioioi.base.tests.check_is_accessible oioioi.base.tests.check_ajax_not_accessible oioioi.base.tests.needs_linux .. py:class:: _AssertNumQueriesLessThanContext(test_case, num, connection) Bases: :py:obj:`django.test.utils.CaptureQueriesContext` Context manager that captures queries executed by the specified connection. .. py:method:: __exit__(exc_type, exc_value, traceback) .. py:class:: TestCase(methodName='runTest') Bases: :py:obj:`django.test.TestCase` Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase. .. py:method:: assertNumQueriesLessThan(num, *args, **kwargs) .. py:method:: assertRegex(text, regex, msg=None) Fail the test unless the text matches the regular expression. .. py:method:: assertNotRegex(text, regex, msg=None) Fail the test if the text matches the regular expression. .. py:class:: IgnorePasswordAuthBackend Bases: :py:obj:`object` An authentication backend which accepts any password for an existing user. It's configured in ``test_settings.py`` and available for all tests. .. py:attribute:: supports_authentication :annotation: = True .. py:attribute:: description .. py:method:: authenticate(request, username=None, password=None, **kwargs) .. py:method:: get_user(user_id) .. py:class:: FakeTimeMiddleware(get_response) Bases: :py:obj:`object` .. py:attribute:: _fake_timestamp .. py:method:: __call__(request) .. py:method:: _process_request(request) .. py:function:: fake_time(timestamp) A context manager which causes all requests having the specified timestamp, regardless of the real wall clock time. .. py:function:: fake_timezone_now(timestamp) .. py:function:: get_url(url_or_viewname, qs, *args, **kwargs) .. py:function:: check_not_accessible(testcase, url_or_viewname, qs=None, *args, **kwargs) .. py:function:: check_is_accessible(testcase, url_or_viewname, qs=None, *args, **kwargs) .. py:function:: check_ajax_not_accessible(testcase, url_or_viewname, *args, **kwargs) .. py:class:: TestsUtilsMixin Bases: :py:obj:`object` .. py:method:: assertAllIn(elems, container, msg=None) Checks that ``container`` contains all ``elems``. .. py:method:: assertNoneIn(elems, container, msg=None) Checks that ``container`` doesn't contain any of ``elems``. .. py:function:: needs_linux(fn)