Exemplo n.º 1
0
 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")
Exemplo n.º 2
0
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()
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
 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")
Exemplo n.º 5
0
 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")
Exemplo n.º 6
0
 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")