File: __init__.py

package info (click to toggle)
python-django-rules 3.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 320 kB
  • sloc: python: 1,613; makefile: 5; sh: 3
file content (23 lines) | stat: -rw-r--r-- 654 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from django.contrib.auth.models import Group, User

import testapp.rules  # noqa .imported to register rules
from testapp.models import Book

ISBN = "978-1-4302-1936-1"


class TestData:
    @classmethod
    def setUpTestData(cls):
        adrian = User.objects.create_user(
            "adrian", password="secr3t", is_superuser=True, is_staff=True
        )

        martin = User.objects.create_user("martin", password="secr3t", is_staff=True)

        editors = Group.objects.create(name="editors")
        martin.groups.add(editors)

        Book.objects.create(
            isbn=ISBN, title="The Definitive Guide to Django", author=adrian
        )