mgorsk1 commented on a change in pull request #6820: [AIRFLOW-6255] Redis Hook 
Refactor
URL: https://github.com/apache/airflow/pull/6820#discussion_r358440921
 
 

 ##########
 File path: tests/contrib/hooks/test_redis_hook.py
 ##########
 @@ -41,17 +41,33 @@ def test_get_conn_password_stays_none(self):
 
     def test_real_ping(self):
         hook = RedisHook(redis_conn_id='redis_default')
-        redis = hook.get_conn()
 
-        self.assertTrue(redis.ping(), 'Connection to Redis with PING works.')
+        self.assertTrue(hook.ping_redis(), 'Connection to Redis with PING 
works.')
 
     def test_real_get_and_set(self):
         hook = RedisHook(redis_conn_id='redis_default')
-        redis = hook.get_conn()
 
-        self.assertTrue(redis.set('test_key', 'test_value'), 'Connection to 
Redis with SET works.')
-        self.assertEqual(redis.get('test_key'), b'test_value', 'Connection to 
Redis with GET works.')
-        self.assertEqual(redis.delete('test_key'), 1, 'Connection to Redis 
with DELETE works.')
+        self.assertTrue(hook.set_key_value('test_key', 'test_value'), 
'Connection to Redis with SET works.')
+        self.assertEqual(hook.get_key('test_key'), b'test_value', 'Connection 
to Redis with GET works.')
+        self.assertEqual(hook.delete_key('test_key'), 1, 'Connection to Redis 
with DELETE works.')
+
+    def test_exists(self):
+        hook = RedisHook(redis_conn_id='redis_default')
+
+        k, v = 'test_key_exists_true', 'test_val'
+
+        hook.set_key_value(k, v)
+
+        assert hook.check_if_key_exists(k)
+
+        hook.delete_key(k)
 
 Review comment:
   ok, mocked in hook tests for starters

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to