def test_delete_permission_has_created_tagging(self): self.episode.set_tag_names(['sssssh'], user=self.user) request = self.rf.get('/admin/meh/') request.user = self.user admin = UserProfileAdmin(self.user, self.site) has_perm = admin.has_delete_permission(request, obj=self.user) self.assertFalse(has_perm)
def test_delete_permission_has_updated_episode(self): self.episode.updated_by = self.user self.episode.save() request = self.rf.get('/admin/meh/') request.user = self.user admin = UserProfileAdmin(self.user, self.site) has_perm = admin.has_delete_permission(request, obj=self.user) self.assertFalse(has_perm)
def test_delete_permission_has_updated_subrecord(self): dem = self.patient.demographics() dem.updated_by = self.user dem.save() request = self.rf.get('/admin/meh/') request.user = self.user admin = UserProfileAdmin(self.user, self.site) has_perm = admin.has_delete_permission(request, obj=self.user) self.assertFalse(has_perm)
def test_delete_permission_obj_is_none(self): request = self.rf.get('/admin/meh/') request.user = self.user admin = UserProfileAdmin(self.user, self.site) has_perm = admin.has_delete_permission(request) self.assertTrue(has_perm)
def test_delete_permission_has_been_lazy_and_done_nothing(self): request = self.rf.get('/admin/meh/') request.user = self.user admin = UserProfileAdmin(self.user, self.site) has_perm = admin.has_delete_permission(request, obj=self.user) self.assertTrue(has_perm)
def test_get_actions(self): request = self.rf.get('/admin/meh/') actions = UserProfileAdmin(self.user, self.site).get_actions(request) self.assertNotIn('delete_selected', actions)