Commit 864ee9de authored by Huihui, Jonathan's avatar Huihui, Jonathan
Browse files

added test for mssql mixin query

parent 3249c6ab
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -31,15 +31,6 @@ class PostgresTestCase(unittest.TestCase):
        with DBPG() as data_base:
            print(data_base.query("SELECT * FROM test_table"))
            
class MSSQLTestCase(unittest.TestCase):
    """Test the Postgres connection case."""
    def test_open(self):
        """
        test_open:
            Test that the DB can successfully be opened
        """
        with DBMSAzure() as db:
            res = db.query("SELECT * FROM CommonDB.dbo.TestDBTable")

class DBConnTestCase(unittest.TestCase):
    def test_connection(self):
+13 −2
Original line number Diff line number Diff line
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Test mssql mixin """

import unittest
from datetime import datetime
from webbrowser import get
from common.database import Database
@@ -22,10 +22,21 @@ class DBMSAzure(MSSQLMixin, Database):
        else: 
            return {"msg":"fail"}

class DBMS_TestCase(unittest.TestCase):
    """ Test connection via query to test db from csv. """
    def test_open(self):
        """
        test_open:
            Test that the DB can successfully be opened
        """
        with DBMSAzure() as db:
            res = db.query("SELECT * FROM CommonDB.dbo.TestDBTable")
            self.assertEqual(len(res), 7)

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