Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
__init__.py 839 B
import logging
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.test import Client
from django.test import TestCase

from functions import create_worker

settings.MEDIA_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')

logger = logging.getLogger(__name__)


class LoggedInTestCase(TestCase):
    def setUp(self):
        self.client = Client()
        username = 'piotr'
        password = 'top_secret'
        self.user = User.objects.create_user(
            username=username, email='jacob@bla', password=password)
        self.client.login(username=username, password=password)


class LoggedInWithWorkerTestCase(LoggedInTestCase):
    def setUp(self):
        super(LoggedInWithWorkerTestCase, self).setUp()
        self.worker = create_worker(self.user, True)