Exemplo n.º 1
0
 def test_locks_do_not_leak_info(self, cache_mock):
     """Should not use plaintext key in lock name"""
     email = '*****@*****.**'
     cache_mock.add.return_value = True
     get_lock(email)
     key = cache_mock.add.call_args[0][0]
     self.assertNotIn(email, key)
Exemplo n.º 2
0
 def test_locks_do_not_leak_info(self, cache_mock):
     """Should not use plaintext key in lock name"""
     email = '*****@*****.**'
     cache_mock.add.return_value = True
     get_lock(email)
     key = cache_mock.add.call_args[0][0]
     self.assertNotIn(email, key)
Exemplo n.º 3
0
 def test_lock_prefix_works(self):
     """Should allow same key to not lock other prefixes"""
     get_lock('*****@*****.**', prefix='malibu')
     get_lock('*****@*****.**', prefix='in-n-out')
     with self.assertRaises(RetryTask):
         get_lock('*****@*****.**', prefix='malibu')
Exemplo n.º 4
0
 def test_locks_work(self):
     """Calling get_lock more than once quickly with the same key should be locked"""
     get_lock('*****@*****.**')
     with self.assertRaises(RetryTask):
         get_lock('*****@*****.**')
Exemplo n.º 5
0
 def test_lock_prefix_works(self):
     """Should allow same key to not lock other prefixes"""
     get_lock('*****@*****.**', prefix='malibu')
     get_lock('*****@*****.**', prefix='in-n-out')
     with self.assertRaises(RetryTask):
         get_lock('*****@*****.**', prefix='malibu')
Exemplo n.º 6
0
 def test_locks_work(self):
     """Calling get_lock more than once quickly with the same key should be locked"""
     get_lock('*****@*****.**')
     with self.assertRaises(RetryTask):
         get_lock('*****@*****.**')