Ejemplo n.º 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'
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 4
0
 def test_get_short_name(self):
     factory = EditorFactory(username='******', name='Bryan')
     assert factory.get_short_name() == 'Bryan'