def test_get_batch_source_path_exists_true(self, get_connection): """ Test :py:meth:`.BaseImporter.get_batch_source_path_exists`. This tests the case of ``True``. """ connection = get_connection.return_value cursor = connection.cursor.return_value cursor.fetchone.return_value = ['test/path'] self.assertTrue( BaseImporter.get_batch_source_path_exists( 'test/path', odbc_kwargs={'dsn': 'TestDSN'}) ) get_connection.assert_called_once_with(dsn='TestDSN') connection.cursor.assert_called_once_with() cursor.execute.assert_called_once_with( 'SELECT batch_source_path FROM meta.batch_history ' 'WHERE batch_source_name = ? AND batch_source_type_name = ? AND ' 'batch_source_path = ? LIMIT 1', 'test_bsn', 'ga3', 'test/path' ) cursor.fetchone.assert_called_once_with()
def test_get_batch_source_path_exists_false(self, get_connection): """ Test :py:meth:`.BaseImporter.get_batch_source_path_exists`. This tests the case of ``False``. """ connection = get_connection.return_value cursor = connection.cursor.return_value cursor.fetchone.return_value = None self.assertFalse(BaseImporter.get_batch_source_path_exists("test/path", odbc_kwargs={"dsn": "TestDSN"}))
def test_get_batch_source_path_exists_false(self, get_connection): """ Test :py:meth:`.BaseImporter.get_batch_source_path_exists`. This tests the case of ``False``. """ connection = get_connection.return_value cursor = connection.cursor.return_value cursor.fetchone.return_value = None self.assertFalse( BaseImporter.get_batch_source_path_exists( 'test/path', odbc_kwargs={'dsn': 'TestDSN'}))
def test_get_batch_source_path_exists_true(self, get_connection): """ Test :py:meth:`.BaseImporter.get_batch_source_path_exists`. This tests the case of ``True``. """ connection = get_connection.return_value cursor = connection.cursor.return_value cursor.fetchone.return_value = ['test/path'] self.assertTrue( BaseImporter.get_batch_source_path_exists( 'test/path', odbc_kwargs={'dsn': 'TestDSN'})) get_connection.assert_called_once_with(dsn='TestDSN') connection.cursor.assert_called_once_with() cursor.execute.assert_called_once_with( 'SELECT batch_source_path FROM meta.batch_history ' 'WHERE batch_source_name = ? AND batch_source_type_name = ? AND ' 'batch_source_path = ? LIMIT 1', 'test_bsn', 'ga3', 'test/path') cursor.fetchone.assert_called_once_with()
def test_get_batch_source_path_exists_true(self, get_connection): """ Test :py:meth:`.BaseImporter.get_batch_source_path_exists`. This tests the case of ``True``. """ connection = get_connection.return_value cursor = connection.cursor.return_value cursor.fetchone.return_value = ["test/path"] self.assertTrue(BaseImporter.get_batch_source_path_exists("test/path", odbc_kwargs={"dsn": "TestDSN"})) get_connection.assert_called_once_with(dsn="TestDSN") connection.cursor.assert_called_once_with() cursor.execute.assert_called_once_with( "SELECT batch_source_path FROM meta.batch_history " "WHERE batch_source_name = ? AND batch_source_type_name = ? AND " "batch_source_path = ? LIMIT 1", "test_bsn", "ga3", "test/path", ) cursor.fetchone.assert_called_once_with()