def test_adds_each_key(self, mock_time, mock_get):
     mock_zadd = Mock()
     mock_get.return_value = Mock(zadd=mock_zadd)
     add_to_redis(Mock(id=1), ["spam", "eggs"])
     calls = [
         call("spam", 123, "1"),
         call("eggs", 123, "1"),
     ]
     self.assertEqual(mock_zadd.call_args_list, calls)
Esempio n. 2
0
 def test_adds_each_key(self, mock_time, mock_get):
     mock_hset = Mock()
     mock_zadd = Mock()
     mock_get.return_value = Mock(hset=mock_hset, zadd=mock_zadd, zrank=Mock(return_value=None))
     add_to_redis(Mock(id=2), Mock(id=1), ["spam", "eggs"])
     calls = [
         call("spam", 123, 2),
         call("eggs", 123, 2),
     ]
     self.assertEqual(mock_zadd.call_args_list, calls)
     calls = [
         call("spam:throughs", 2, 1),
         call("eggs:throughs", 2, 1),
     ]
     self.assertEqual(mock_hset.call_args_list, calls)
Esempio n. 3
0
 def test_adds_each_key(self, mock_time, mock_get):
     mock_hset = Mock()
     mock_zadd = Mock()
     mock_get.return_value = Mock(hset=mock_hset, zadd=mock_zadd, zrank=Mock(return_value=None))
     add_to_redis(Mock(id=2), Mock(id=1), ["spam", "eggs"])
     calls = [
         call("spam", 123, 2),
         call("eggs", 123, 2),
     ]
     self.assertEqual(mock_zadd.call_args_list, calls)
     calls = [
         call("spam:throughs", 2, 1),
         call("eggs:throughs", 2, 1),
     ]
     self.assertEqual(mock_hset.call_args_list, calls)
 def test_returns_on_no_keys(self, mock_time, mock_get):
     mock_zadd = Mock()
     mock_get.return_value = Mock(zadd=mock_zadd)
     add_to_redis(Mock(), [])
Esempio n. 5
0
 def test_returns_on_no_keys(self, mock_time, mock_get):
     mock_zadd = Mock()
     mock_get.return_value = Mock(zadd=mock_zadd, zrank=Mock(return_value=None))
     add_to_redis(Mock(), Mock(), [])