from django.contrib.auth.models import User
from django.test import Client
from django.test import TestCase

from functions import create_worker


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)