More checks on db test initialization
@@ -18,6 +18,10 @@ def db_socket(request):
# IP/port/drop table is specific to build
if request.param == "mongo":
db = dserver.db_socket_factory("127.0.0.1", 27017, db_name, db_type=request.param)
+
+ # Clean and re-init the databse
+ db.client.drop_database(db._project_name)
+ db.init_database()
else:
raise KeyError("DB type %s not understood" % request.param)
@@ -60,15 +64,13 @@ def test_molecule_add_many(db_socket):
assert ret["nInserted"] == 2
ret = db_socket.get_molecules([water.get_hash(), water2.get_hash(), "something"])
- assert len(ret) == 2
+ assert len(list(ret)) == 2
# Cleanup adds
ret = db_socket.del_molecule_by_hash([water.get_hash(), water2.get_hash()])
assert ret == 2
-
-
def test_options_add(db_socket):
opts = dclient.data.get_options("psi_default")
@@ -81,6 +83,7 @@ def test_options_add(db_socket):
assert opts == db_socket.get_option(opts["name"], opts["program"])
+
def test_options_error(db_socket):
opts = dclient.data.get_options("psi_default")
@@ -88,5 +91,3 @@ def test_options_error(db_socket):
ret = db_socket.add_options(opts)
assert ret["nInserted"] == 0
assert len(ret["validation_errors"]) == 1
-
-
