Skip to main content

Simple enhancement to the TestCase which creates user and loggs him in.

Project description

https://badge.fury.io/py/django-logon-testcase.svg https://travis-ci.org/petr.dlouhy/django-logon-testcase.svg?branch=master https://codecov.io/gh/petr.dlouhy/django-logon-testcase/branch/master/graph/badge.svg

Simple enhancement to the TestCase which creates user and loggs him in.

Documentation

The full documentation is at https://django-logon-testcase.readthedocs.io.

Quickstart

Install Django Logon TestCase:

pip install django-logon-testcase

Use it in your tests:

from django.test import TestCase

from logon_testcase import LogonMixin

class MyTestCase(LogonMixin, TestCase):
     ...

The logged user is available in self.user variable.

Features

You can get your own user for the test by overriding get_user function:

class MyTestCase(LogonMixin):
     def get_user(self):
         return User.objects.create()

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

History

0.1.0 (2017-08-10)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-logon-testcase-0.1.0.tar.gz (14.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page