예제 #1
0
 def test_ThreadLocalsClass(self):
     request = threadlocals.ThreadLocals()  # almost any class except object() would work
     request.user = user = random()
     request.META = {}
     request.META["REMOTE_ADDR"] = addr = random()
     threadlocals.ThreadLocals().process_request(request)
     self.assertEqual(user, threadlocals.get_current_user())
     self.assertEqual(addr, threadlocals.get_remote_ip())
예제 #2
0
 def test_GetSetLocalUser(self):
     self.assert_(threadlocals.get_current_user() is None)
     val = random()
     threadlocals.set_current_user(val)
     self.assertEquals(val, threadlocals.get_current_user())