# Path: staff/models.py
# class StaffMember(BaseStaffMember):
#     pass


from django.test import TestCase
from django.contrib.auth.models import User
from staff.models import StaffMember
from django.template.defaultfilters import slugify
    """Tests for the Staff model"""
    def setUp(self):
        self.user = User.objects.create_user("tempuser", "tempuser", "temp@user.com")
        self.user.first_name = "Temporary"
        self.user.last_name = "User"
        self.user.save()

    def assertStaffInfoEqual(self, staffmember, user):
        self.assertEqual(staffmember.first_name, user.first_name)
        self.assertEqual(staffmember.last_name, user.last_name)
        self.assertEqual(staffmember.email, user.email)
        self.assertEqual(staffmember.slug, slugify('%s %s' % (user.first_name, user.last_name)))

    def testAutoCreation(self):
        self.assertEqual(StaffMember.objects.all().count(), 0)
        self.user.is_staff = True
        self.user.save()
        self.assertEqual(StaffMember.objects.all().count(), 1)
        s = self.user.staffmember_set.all()[0]
        self.assertStaffInfoEqual(s, self.user)

    def testAutoDeactivation(self):
        self.assertEqual(StaffMember.objects.all().count(), 0)
        self.user.is_staff = True
        self.user.save()
        self.assertEqual(StaffMember.objects.all().count(), 1)
        self.user.is_staff = False
        self.user.save()
        self.assertEqual(StaffMember.objects.all().count(), 1)
        self.assertEqual(StaffMember.objects.inactive().count(), 1)

# Path: staff/models.py
# class StaffMember(BaseStaffMember):
#     pass


# Path: staff/tests.py
from django.test import TestCase
from django.contrib.auth.models import User
from staff.models import StaffMember
from django.template.defaultfilters import slugify

    """Tests for the Staff model"""
    def setUp(self):
        self.user = User.objects.create_user("tempuser", "tempuser", "temp@user.com")
        self.user.first_name = "Temporary"
        self.user.last_name = "User"
        self.user.save()

    def assertStaffInfoEqual(self, staffmember, user):
        self.assertEqual(staffmember.first_name, user.first_name)
        self.assertEqual(staffmember.last_name, user.last_name)
        self.assertEqual(staffmember.email, user.email)
        self.assertEqual(staffmember.slug, slugify('%s %s' % (user.first_name, user.last_name)))

    def testAutoCreation(self):
        self.assertEqual(StaffMember.objects.all().count(), 0)
        self.user.is_staff = True
        self.user.save()
        self.assertEqual(StaffMember.objects.all().count(), 1)
        s = self.user.staffmember_set.all()[0]
        self.assertStaffInfoEqual(s, self.user)

    def testAutoDeactivation(self):
        self.assertEqual(StaffMember.objects.all().count(), 0)
        self.user.is_staff = True
        self.user.save()
        self.assertEqual(StaffMember.objects.all().count(), 1)
        self.user.is_staff = False
        self.user.save()
        self.assertEqual(StaffMember.objects.all().count(), 1)
        self.assertEqual(StaffMember.objects.inactive().count(), 1)

        self.assertEqual(StaffMember.objects.active().count(), 0)