def test_2407_heterogeneous(self):
     "2407 - test heterogeneous pool with user and password specified"
     pool = test_env.get_pool(min=2,
                              max=8,
                              increment=3,
                              homogeneous=False,
                              getmode=oracledb.SPOOL_ATTRVAL_WAIT)
     self.assertEqual(pool.homogeneous, 0)
     conn = pool.acquire()
     self.__verify_connection(pool.acquire(), test_env.get_main_user())
     conn.close()
     conn = pool.acquire(test_env.get_main_user(),
                         test_env.get_main_password())
     self.__verify_connection(conn, test_env.get_main_user())
     conn.close()
     conn = pool.acquire(test_env.get_proxy_user(),
                         test_env.get_proxy_password())
     self.__verify_connection(conn, test_env.get_proxy_user())
     conn.close()
     user_str = "%s[%s]" % \
             (test_env.get_main_user(), test_env.get_proxy_user())
     conn = pool.acquire(user_str, test_env.get_main_password())
     self.__verify_connection(conn, test_env.get_proxy_user(),
                              test_env.get_main_user())
     conn.close()
 def test_2408_heterogenous_without_user(self):
     "2408 - test heterogeneous pool without user and password specified"
     pool = test_env.get_pool(user="", password="", min=2, max=8,
                              increment=3,
                              getmode=oracledb.SPOOL_ATTRVAL_WAIT,
                              homogeneous=False)
     self.__verify_connection(pool.acquire(test_env.get_main_user(),
                              test_env.get_main_password()),
                              test_env.get_main_user())
     self.__verify_connection(pool.acquire(test_env.get_proxy_user(),
                              test_env.get_proxy_password()),
                              test_env.get_proxy_user())
     user_str = "%s[%s]" % \
             (test_env.get_main_user(), test_env.get_proxy_user())
     self.__verify_connection(pool.acquire(user_str,
                              test_env.get_main_password()),
                              test_env.get_proxy_user(),
                              test_env.get_main_user())
Exemplo n.º 3
0
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# SetupTest.py
#
# Creates users and populates their schemas with the tables and packages
# necessary for the cx_Oracle test suite.
#------------------------------------------------------------------------------

import cx_Oracle

import test_env
import DropTest

# connect as administrative user (usually SYSTEM or ADMIN)
conn = cx_Oracle.connect(test_env.get_admin_connect_string())

# drop existing users and editions, if applicable
DropTest.drop_tests(conn)

# create test schemas
print("Creating test schemas...")
test_env.run_sql_script(conn,
                        "SetupTest",
                        main_user=test_env.get_main_user(),
                        main_password=test_env.get_main_password(),
                        proxy_user=test_env.get_proxy_user(),
                        proxy_password=test_env.get_proxy_password())
print("Done.")