TireSwingSoftware/openassign-server — Issue #32: Problem deleting users (with admin token)
Author: jc0n
Created: 2011-11-01 00:17:02+00:00
State: open

I am in the process of writing the following test which is for Issue #17. In this case, users are created by setUp and then deleted to test the persistence of the "persistent" roles. I am unable to delete them with an admin token.

def test_delete(self):
# XXX: why are these failing? admin should be able to delete users?
self.user_manager.delete(self.admin_token, self.user1.id)
self.user_manager.delete(self.admin_token, self.user2.id)

UserOrgRole = facade.models.UserOrgRole

# compare remaining roles with the slots we made earlier
slots = UserOrgRole.objects.all()
self.assertEquals(slots, self.slots)

I get the following error and I'm not sure why:

======================================================================
ERROR: test_delete (pr_services.pr_tests.TestOrgSlots)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jcon/Desktop/projects/openassign-server/pr_services/pr_tests.py", line 3585, in test_delete
self.user_manager.delete(self.admin_token, self.user1.id)
File "/home/jcon/Desktop/projects/openassign-server/pr_services/user_system/user_manager.py", line 974, in delete
raise exceptions.OperationNotPermittedException()
OperationNotPermittedException

I figured I would check the UserManager.test_delete for reference but after doing so I'm not sure what is being tested there or if the test cases are complete. I can't find any tests were a user is actually deleted. For reference: https://github.com/TireSwingSoftware/openassign-server/blob/dev/pr_services/pr_tests.py#L2557