Commit ebcd655f authored by Huihui, Jonathan's avatar Huihui, Jonathan
Browse files

better testing for mssql mixin

parent 43e72c43
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ from common.logz import create_logger
class DBPG(Database, PostgresMixin):
    """Create the Database and PostgresMixin class."""

class DBMSAzure(Database, MSSQLMixin):
class DBMSAzure(MSSQLMixin, Database):
    """Create the Database and MSSQLMixin class."""

class PostgresTestCase(unittest.TestCase):
@@ -39,7 +39,7 @@ class MSSQLTestCase(unittest.TestCase):
            Test that the DB can successfully be opened
        """
        with DBMSAzure() as db:
            print(db.query("SELECT * FROM test_table"))
            res = db.query("SELECT * FROM CommonDB.dbo.TestDBTable")

class DBConnTestCase(unittest.TestCase):
    def test_connection(self):
+10 −3
Original line number Diff line number Diff line
@@ -8,8 +8,10 @@ from common.database import Database
from common.mixins.mssql import MSSQLMixin
from common.logz import create_logger

logger = create_logger()

class DBMSAzure(Database, MSSQLMixin):

class DBMSAzure(MSSQLMixin, Database):
    """ Create the Database with MSSQLMixin class. """
    def __init__(self, **kwargs):
        super().__init__()
@@ -20,5 +22,10 @@ class DBMSAzure(Database, MSSQLMixin):
        else: 
            return {"msg":"fail"}
    

if __name__ == "__main__":
    with DBMSAzure() as db:
    db.access()
        logger.info(db.access())
    logger.info(f"This is a logging statment.")