Utils Test

inyoka.testing

Various utilities and helpers that improve our unittest experience.

copyright:
  1. 2007-2024 by the Inyoka Team, see AUTHORS for more details.

license:

BSD, see LICENSE for more details.

class inyoka.utils.test.AntiSpamTestCaseMixin
make_mark_ham()
make_mark_spam()
make_spam()
make_valid_key()
class inyoka.utils.test.InyokaClient(enforce_csrf_checks=False, host=None, **defaults)

In order to change the requesting host, use:

client.defaults['HTTP_HOST'] = 'url.example.com'
login(**credentials)

Try to authenticate a user with username and password.

Parameters:
  • username (str) – The username of the User to log in

  • password (str) – The password of the user to login

Raise:
User.DoesNotExist

If the user with username does not exist

UserBanned

If the found user is banned

Returns:

True in case the described user can be logged in, and is active, False otherwise.

class inyoka.utils.test.TestCase(methodName='runTest')

Default TestCase for all Inyoka tests.

Deletes the content cache after each run.

_classSetupFailed = False
_class_cleanups = []
_post_teardown()

Flush cache

assertXMLEqual(xml1, xml2, msg=None)

Prettify comparison of two XML strings

inyoka.utils.test.profile_memory(func)