Esempio n. 1
0
    def test_get_last_imported_batch_source_path_none(self, get_connection):
        """
        Test :py:meth:`.BaseImporter.get_last_imported_batch_source_path`.

        This tests the case of returning ``None``.
        """
        connection = get_connection.return_value
        cursor = connection.cursor.return_value
        cursor.fetchone.return_value = None

        self.assertEqual(None, BaseImporter.get_last_imported_batch_source_path(odbc_kwargs={"dsn": "TestDSN"}))
Esempio n. 2
0
    def test_get_last_imported_batch_source_path_none(self, get_connection):
        """
        Test :py:meth:`.BaseImporter.get_last_imported_batch_source_path`.

        This tests the case of returning ``None``.
        """
        connection = get_connection.return_value
        cursor = connection.cursor.return_value
        cursor.fetchone.return_value = None

        self.assertEqual(
            None,
            BaseImporter.get_last_imported_batch_source_path(
                odbc_kwargs={'dsn': 'TestDSN'}))
Esempio n. 3
0
    def test_get_last_imported_batch_source_path(self, get_connection):
        """
        Test :py:meth:`.BaseImporter.get_last_imported_batch_souce_path`.
        """
        connection = get_connection.return_value
        cursor = connection.cursor.return_value
        cursor.fetchone.return_value = ("foo/bar",)

        self.assertEqual("foo/bar", BaseImporter.get_last_imported_batch_source_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 = ? "
            "ORDER BY batch_import_timestamp DESC LIMIT 1",
            "test_bsn",
            "ga3",
        )
Esempio n. 4
0
    def test_get_last_imported_batch_source_path(self, get_connection):
        """
        Test :py:meth:`.BaseImporter.get_last_imported_batch_souce_path`.
        """
        connection = get_connection.return_value
        cursor = connection.cursor.return_value
        cursor.fetchone.return_value = ('foo/bar', )

        self.assertEqual(
            'foo/bar',
            BaseImporter.get_last_imported_batch_source_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 = ? '
            'ORDER BY batch_import_timestamp DESC LIMIT 1', 'test_bsn', 'ga3')
Esempio n. 5
0
    def test_get_last_imported_batch_source_path(self, get_connection):
        """
        Test :py:meth:`.BaseImporter.get_last_imported_batch_souce_path`.
        """
        connection = get_connection.return_value
        cursor = connection.cursor.return_value
        cursor.fetchone.return_value = ('foo/bar',)

        self.assertEqual(
            'foo/bar',
            BaseImporter.get_last_imported_batch_source_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 = ? '
            'ORDER BY batch_import_timestamp DESC LIMIT 1',
            'test_bsn',
            'ga3'
        )