예제 #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")
예제 #2
0
파일: steps.py 프로젝트: jessingrass/mittn
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()
예제 #3
0
파일: steps.py 프로젝트: nagyistge/mittn
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()
예제 #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")
예제 #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")
예제 #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")