예제 #1
0
 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'
예제 #2
0
    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')
예제 #3
0
    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')
예제 #4
0
 def test_get_short_name(self):
     factory = EditorFactory(username='******', name='Bryan')
     assert factory.get_short_name() == 'Bryan'