From 580dfeeb78507d3a4a593914399395ae9cb894ac Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Fri, 19 Jul 2019 14:55:56 +0200
Subject: [PATCH] a couple more tests for coverage

---
 test/test_celery_worker_global.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/test/test_celery_worker_global.py b/test/test_celery_worker_global.py
index dd840d3f..a67d07c4 100644
--- a/test/test_celery_worker_global.py
+++ b/test/test_celery_worker_global.py
@@ -6,6 +6,8 @@ import contextlib
 import os
 
 from inventory_provider.tasks import worker
+from inventory_provider.tasks import common
+
 
 from inventory_provider.tasks.common import _get_redis
 
@@ -50,7 +52,26 @@ def test_update_locations(mocker, mocked_worker_module, mocked_redis):
 
 
 def test_InventoryTask_obj(data_config_filename):
-
     os.environ['INVENTORY_PROVIDER_CONFIG_FILENAME'] = data_config_filename
     task = worker.InventoryTask()
     assert task.config
+
+
+def test_next_redis(data_config, mocked_redis):
+    common.set_latch(data_config, 10, 20)
+    r = common.get_next_redis(data_config)
+    assert r
+
+    # there's only one ...
+    latch = common.get_latch(r)
+    assert latch['current'] == 10
+    assert latch['next'] == 20
+
+
+def test_next_redis_with_none(data_config, mocked_redis):
+    r = common._get_redis(data_config)
+    assert r
+
+    del r.db['db:latch']  # cf. conftest:MockedRedis
+    r = common.get_next_redis(data_config)
+    assert r
-- 
GitLab