def test_initAlias1():
    """ calls initAlias with bogus arguments.  Should succeed."""    
    alias='pomposity'
    D.initAlias(alias, 'anything', 'anything', True, True)
    try:
        assert D._aliases.has_key(alias)
    finally:
        D.delAlias(alias)
        assert not D._aliases.has_key(alias)
Example #2
0
def test_initAlias1():
    """ calls initAlias with bogus arguments.  Should succeed."""
    alias = 'pomposity'
    D.initAlias(alias, 'anything', 'anything', True, True)
    try:
        assert D._aliases.has_key(alias)
    finally:
        D.delAlias(alias)
        assert not D._aliases.has_key(alias)
Example #3
0
def test_initAlias2():
    """ calls initAlias twice with the same arguments.  Should succeed. """
    alias = 'fruitcake'
    driver = 'pong'
    connectArgs = 'blimp'

    D.initAlias(alias, driver, connectArgs)
    try:
        try:
            D.initAlias(alias, driver, connectArgs)
        except ValueError:
            raise ValueError, \
                  "ValueError should not be raised when an alias is reinitialized"\
                  " with identical data!"

    finally:
        D.delAlias(alias)
def test_initAlias2():
    """ calls initAlias twice with the same arguments.  Should succeed. """
    alias='fruitcake'
    driver='pong'
    connectArgs='blimp'
    
    D.initAlias(alias, driver, connectArgs)
    try:
        try:
            D.initAlias(alias, driver, connectArgs)
        except ValueError:
            raise ValueError, \
                  "ValueError should not be raised when an alias is reinitialized"\
                  " with identical data!"
        
    finally:
        D.delAlias(alias)
Example #5
0
def test_initAlias3():
    """ calls initAlias twice with different arguments.  Should fail. """
    alias = 'fruitcake'
    driver = 'pong'
    connectArgs = 'blimp'
    D.initAlias(alias, driver, connectArgs)
    connectArgs = 'potato'
    try:
        try:
            D.initAlias(alias, driver, connectArgs)
        except ValueError:
            error_raised = True
        else:
            error_raised = False
        assert error_raised, \
               "ValueError should be raised when a change is made to alias config"
    finally:
        D.delAlias(alias)
def test_initAlias3():
    """ calls initAlias twice with different arguments.  Should fail. """
    alias='fruitcake'
    driver='pong'
    connectArgs='blimp'
    D.initAlias(alias, driver, connectArgs)
    connectArgs='potato'
    try:
        try:
            D.initAlias(alias, driver, connectArgs)
        except ValueError:
            error_raised=True
        else:
            error_raised=False
        assert error_raised, \
               "ValueError should be raised when a change is made to alias config"
    finally:
        D.delAlias(alias)
Example #7
0
def test_pool1():
    stuff = D._aliases['pydotest'].copy()
    D.initAlias('pydotestpool', stuff['driver'], stuff['connectArgs'],
                D.ConnectionPool(max_poolsize=4, keep_poolsize=4),
                stuff['verbose'])
    db = D.getConnection('pydotestpool')
    try:
        assert len(db.pool._busy) == 0
        assert len(db.pool._free) == 0
        conn = db.conn
        assert len(db.pool._busy) == 1
        assert len(db.pool._free) == 0
        c = conn.cursor()
        c.execute('SELECT 1+1')
        res = c.fetchone()
        assert res[0] == 2
        c.close()
        conn.close()
        assert len(db.pool._busy) == 0
        assert len(db.pool._free) == 1
    finally:
        D.delAlias('pydotestpool')
def test_pool1():
    stuff=D._aliases['pydotest'].copy()
    D.initAlias('pydotestpool',
                stuff['driver'],
                stuff['connectArgs'],
                D.ConnectionPool(max_poolsize=4, keep_poolsize=4),
                stuff['verbose'])
    db=D.getConnection('pydotestpool')
    try:
        assert len(db.pool._busy)==0
        assert len(db.pool._free)==0
        conn=db.conn
        assert len(db.pool._busy)==1
        assert len(db.pool._free)==0
        c=conn.cursor()
        c.execute('SELECT 1+1')
        res=c.fetchone()
        assert res[0]==2
        c.close()
        conn.close()
        assert len(db.pool._busy)==0
        assert len(db.pool._free)==1
    finally:
        D.delAlias('pydotestpool')
Example #9
0
def test_delAlias1():
    """ calls delAlias for an alias that does not exist. Should succeed."""
    D.delAlias('jackandjill')
Example #10
0
def test_delAlias1():
    """ calls delAlias for an alias that does not exist. Should succeed."""
    D.delAlias('jackandjill')