X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=osm_common%2Ftests%2Ftest_dbbase.py;h=c2af52f6bcb1aeb78ac372b70ca07d386b693f72;hb=b20a902cfc15e04f623b83e8756463540f3e7852;hp=dec65a84c6bc8abb203531458f4a11a66e7cff2a;hpb=4d611d38236ddb5834c48d9228ba78c86b5cbfc5;p=osm%2Fcommon.git diff --git a/osm_common/tests/test_dbbase.py b/osm_common/tests/test_dbbase.py index dec65a8..c2af52f 100644 --- a/osm_common/tests/test_dbbase.py +++ b/osm_common/tests/test_dbbase.py @@ -3,49 +3,58 @@ import pytest from osm_common.dbbase import DbBase, DbException + def exception_message(message): return "database exception " + message + @pytest.fixture def db_base(): return DbBase() + def test_constructor(): db_base = DbBase() - - assert db_base != None + assert db_base is not None assert isinstance(db_base, DbBase) + def test_db_connect(db_base): db_base.db_connect(None) + def test_db_disconnect(db_base): db_base.db_disconnect() + def test_get_list(db_base): with pytest.raises(DbException) as excinfo: db_base.get_list(None, None) assert str(excinfo.value).startswith(exception_message("Method 'get_list' not implemented")) assert excinfo.value.http_code == http.HTTPStatus.NOT_FOUND + def test_get_one(db_base): with pytest.raises(DbException) as excinfo: db_base.get_one(None, None, None, None) assert str(excinfo.value).startswith(exception_message("Method 'get_one' not implemented")) assert excinfo.value.http_code == http.HTTPStatus.NOT_FOUND + def test_create(db_base): with pytest.raises(DbException) as excinfo: db_base.create(None, None) assert str(excinfo.value).startswith(exception_message("Method 'create' not implemented")) assert excinfo.value.http_code == http.HTTPStatus.NOT_FOUND + def test_del_list(db_base): with pytest.raises(DbException) as excinfo: db_base.del_list(None, None) assert str(excinfo.value).startswith(exception_message("Method 'del_list' not implemented")) assert excinfo.value.http_code == http.HTTPStatus.NOT_FOUND + def test_del_one(db_base): with pytest.raises(DbException) as excinfo: db_base.del_one(None, None, None)