def test_email_user(self): factory = EditorFactory(email='*****@*****.**') factory.email_user('Subject', 'Hello there.', from_email='*****@*****.**') assert len(mail.outbox) == 1 assert mail.outbox[0].subject == 'Subject'
def test_has_perm(self): staff = EditorFactory(username='******', is_active=True, is_staff=True) assert staff.has_perm('test-perm') notstaff = EditorFactory(username='******', is_active=True) assert not notstaff.has_perm('test-perm')
def test_has_module_perms(self): staff = EditorFactory(username='******', is_active=True, is_staff=True) assert staff.has_module_perms('testapp') notstaff = EditorFactory(username='******', is_active=True) assert not notstaff.has_module_perms('testapp')
def test_get_short_name(self): factory = EditorFactory(username='******', name='Bryan') assert factory.get_short_name() == 'Bryan'