示例#1
0
 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)
示例#2
0
 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)
示例#3
0
文件: views.py 项目: rossz/mlmsite
def graph_eval_leave(request, userid):
    c = Controller()
    c.userLeaves(User.objects.get(id=userid))
    return HttpResponseRedirect('/dev/graph_eval/')
示例#4
0
def graph_eval_leave(request, userid):
    c = Controller()
    c.userLeaves(User.objects.get(id=userid))
    return HttpResponseRedirect('/dev/graph_eval/')