def testRowsCount(self): dbDriver = DBDriverMock() sut = Pydblibrary() sut.connect_to_database(dbDriver, 'someDbName', 'someUsername', 'somePassword', 'someHost', '7777') responses = {'select * from employee': [(0, 'John', 'Doe'), (1, 'Jane', 'Doe')]} dbDriver.connection.cursor().setQueryResponses(responses) self.assertTrue(sut.rows_count('select * from employee') == 2, 'Incorrect rows count.')
def testRowsCount(self): dbDriver = DBDriverMock() sut = Pydblibrary() sut.connect_to_database(dbDriver, 'someDbName', 'someUsername', 'somePassword', 'someHost', '7777') responses = { 'select * from employee': [(0, 'John', 'Doe'), (1, 'Jane', 'Doe')] } dbDriver.connection.cursor().setQueryResponses(responses) self.assertTrue( sut.rows_count('select * from employee') == 2, 'Incorrect rows count.')