Пример #1
0
 def setUp(self):
     super(PersonPositionAdminTest, self).setUp()
     self.user = UserFactory(is_staff=True, is_superuser=True)
     self.person = Person.objects.create()
     self.person_position = Position.objects.create(person=self.person, title='foo')
     self.person_position_admin = PositionAdmin(self.person_position, AdminSite())
     self.request = HttpRequest()
     self.request.user = self.user
Пример #2
0
class PersonPositionAdminTest(TestCase):
    """Tests for person position admin."""

    def setUp(self):
        super(PersonPositionAdminTest, self).setUp()
        self.user = UserFactory(is_staff=True, is_superuser=True)
        self.person = Person.objects.create()
        self.person_position = Position.objects.create(person=self.person, title='foo')
        self.person_position_admin = PositionAdmin(self.person_position, AdminSite())
        self.request = HttpRequest()
        self.request.user = self.user

    def test_delete_permission(self):
        """
        Tests that users cannot delete entries
        """
        self.assertFalse(self.person_position_admin.has_delete_permission(self.request))

    def test_delete_action(self):
        """Tests that user can not have delete action"""
        self.assertNotIn('delete_selected', self.person_position_admin.get_actions(self.request))