def testUserLeaves_MasterCannotLeave(self): c = Controller() with self.assertRaises(MasterUser.MasterCannotLeave): c.userLeaves(MasterUser.Get().id) user1Id = User.objects.create(username="******", sponsor=MasterUser.Get()).id user2Id = User.objects.create(username="******", sponsor=User.Get(user1Id)).id self.assertEqual(User.Get(user2Id).sponsor.id, user1Id) self.assertTrue(User.Get(user1Id).isActive) c.userLeaves(user1Id) self.assertFalse(User.Get(user1Id).isActive) self.assertEqual(User.Get(user2Id).sponsor.id, MasterUser.Get().id)
def graph_eval_leave(request, userid): c = Controller() c.userLeaves(User.objects.get(id=userid)) return HttpResponseRedirect('/dev/graph_eval/')