Commits

Vernon Cole  committed addeb02

dbapi20 test fix last few problemes

  • Participants
  • Parent commits a710c37

Comments (0)

Files changed (4)

File sqlserver_ado/base.py

 
 import adodbapi as Database
 import adodbapi.ado_consts as adc
-Database.adodbapi.defaultCursorLocation = adc.adUseServer # TODO: remove or sanitize this (VDC)
+## Database.adodbapi.defaultCursorLocation = adc.adUseServer # TODO: remove or sanitize this (VDC)
 
 from introspection import DatabaseIntrospection
 from creation import DatabaseCreation

File tests/dbsettings.py

 
 _hack_backend_path()
 
-
-def make_connection_string():
-    # This function duplicates the Django connection string logic, but is meant
-    # to be used by non-Django tests that want to share test db settings.
-    
-    settings = DATABASES.get('default', {})
-    
-    db_host = settings.get('HOST', '127.0.0.1')
-    db_port = settings.get('PORT', '')
-    db_name = settings.get('NAME', '')
-    db_user = settings.get('USER', '')
-    db_pass = settings.get('PASSWORD', '')
-    
-    if db_name == '':
-        raise Exception("You need to specify a DATABASE_NAME in your Django settings file.")
-
-    # If a port is given, force a TCP/IP connection. The host should be an IP address in this case.
-    if db_port != '':
-        if not _looks_like_ipaddress(db_host):
-            raise Exception("When using DATABASE_PORT, DATABASE_HOST must be an IP address.")
-        datasource = '%s,%s;Network Library=DBMSSOCN' % (db_host, db_port)
-
-    # If no user is specified, use integrated security.
-    if db_user != '':
-        auth_string = "UID=%s;PWD=%s" % (db_user, db_pass)
-    else:
-        auth_string = "Integrated Security=SSPI"
-
-    return "PROVIDER=SQLOLEDB;DATA SOURCE=%s;Initial Catalog=%s;%s" % \
-        (db_host, db_name, auth_string)

File tests/test_main/apitest/dbapi20.py

                     'callproc produced invalid results'
                     )
         finally:
-            con.close()
+                con.close()
 
     def test_close(self):
         con = self._connect()

File tests/test_main/apitest/tests.py

         if self.testMethodName()=='test_callproc':
             sql="""
                     create procedure templower
-                        (theData varchar(50))
+                        @theData varchar(50)
                     as
-                        select lower(theData);
+                        select lower(@theData);
                 """
             con = self._connect()
             cur = con.cursor()
-            try:
-                cur.execute(sql)
-                con.commit()
-            except:
-                pass
+            cur.execute(sql)
+            con.commit()
+
             self.lower_func='templower'
 
 
             cur.execute("SELECT %s as A, %s as B, %s as C", expected)
 
             result = tuple(cur.fetchone())         # adodbapi returns a sequence-like object, make it easy to compare
-            self.assertEqual(result[0], expected)
+            self.assertEqual(result, expected)
+
         finally:
             con.close()