Exemple #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())
Exemple #2
0
 def test_GetSetRemoteIP(self):
     self.assert_(threadlocals.get_remote_ip() is None)
     val = random()
     threadlocals.set_remote_ip(val)
     self.assertEquals(val, threadlocals.get_remote_ip())