def test_dburl_not_defined(self): # Try to open connection without a defined database URI empty_context = type('context', (object,), dict()) dbconn = dbtools.open_database(empty_context) self.assertEqual(dbconn, None, "No dburl provided should return None as connection")
def step_impl(context): """Test that we can connect to a database. As a side effect, open_database(9 also creates the necessary table(s) that are required.""" if hasattr(context, 'dburl') is False: assert False, "Database URI not specified" dbconn = scandb.open_database(context) if dbconn is None: assert False, "Cannot open database %s" % context.dburl dbconn.close()
def test_create_db_connection(self): # Try whether an actual database connection can be opened dbconn = dbtools.open_database(self.context) self.assertEqual(type(dbconn), sqlalchemy.engine.base.Connection, "An SQLAlchemy connection object was not returned")
def test_dburl_not_defined(self): # Try to open connection without a defined database URI empty_context = type('context', (object, ), dict()) dbconn = dbtools.open_database(empty_context) self.assertEqual(dbconn, None, "No dburl provided should return None as connection")