def test_fields_with_default_encoding_uses_utf8(self): redis = MagicMock() key = MagicMock() redis_hash = RedisHash(redis, key) redis_hash.fields() redis.hkeys.assert_called_once_with(key, encoding='utf-8')
def test_fields_works_correctly(self): fields = [MagicMock() for _ in range(7)] redis = MagicMock() redis.hkeys.return_value = fields key = MagicMock() encoding = MagicMock() redis_hash = RedisHash(redis, key) result = redis_hash.fields(encoding=encoding) redis.hkeys.assert_called_once_with(key, encoding=encoding) self.assertEqual(result, fields)