From: Eduardo Sousa Date: Wed, 9 May 2018 18:42:00 +0000 (+0100) Subject: Adding tests for unimplemented features X-Git-Tag: v4.0.1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=ce7771d8e8bfff5a3bef70a416d334264f1f539b;p=osm%2Fcommon.git Adding tests for unimplemented features Helps to detect when certain feature was implemented but a test is not in place to verify it. Change-Id: I7a98036c94117b867206dd8c4cc87fa8cfd1eafb Signed-off-by: Eduardo Sousa --- diff --git a/osm_common/tests/test_dbmemory.py b/osm_common/tests/test_dbmemory.py index 55c900f..a11dc1a 100644 --- a/osm_common/tests/test_dbmemory.py +++ b/osm_common/tests/test_dbmemory.py @@ -62,6 +62,9 @@ def test_db_connect(): assert db.logger == logging.getLogger(logger_name) assert len(db.db) == 0 +def test_db_disconnect(db_memory): + db_memory.db_disconnect() + @pytest.mark.parametrize("table, filter", [ ("test", {}), ("test", {"_id": 1}), diff --git a/osm_common/tests/test_fslocal.py b/osm_common/tests/test_fslocal.py index 77886d8..2cc7aec 100644 --- a/osm_common/tests/test_fslocal.py +++ b/osm_common/tests/test_fslocal.py @@ -62,6 +62,15 @@ def test_constructor_with_logger(): assert fs.logger == logging.getLogger(logger_name) assert fs.path is None +def test_get_params(fs_local): + params = fs_local.get_params() + + assert len(params) == 2 + assert "fs" in params + assert "path" in params + assert params["fs"] == "local" + assert params["path"] == valid_path() + @pytest.mark.parametrize("config, exp_logger, exp_path", [ ({'logger_name': 'fs_local', 'path': valid_path()}, 'fs_local', valid_path()), ({'logger_name': 'fs_local', 'path': valid_path()[:-1]}, 'fs_local', valid_path()), @@ -86,6 +95,9 @@ def test_fs_connect_with_invalid_path(config, exp_exception_message): fs.fs_connect(config) assert str(excinfo.value) == exp_exception_message +def test_fs_disconnect(fs_local): + fs_local.fs_disconnect() + def test_mkdir_with_valid_path(fs_local): folder_name = str(uuid.uuid4()) folder_path = valid_path() + folder_name diff --git a/osm_common/tests/test_msgbase.py b/osm_common/tests/test_msgbase.py index c3b9726..4db3997 100644 --- a/osm_common/tests/test_msgbase.py +++ b/osm_common/tests/test_msgbase.py @@ -18,7 +18,7 @@ def test_constructor(): assert isinstance(msgbase, MsgBase) def test_connect(msg_base): - msg_base.connect() + msg_base.connect(None) def test_disconnect(msg_base): msg_base.disconnect()