def test_get_engine_empty_schema(self, mock_keyring_get_password: MagicMock, mock_user_config_dir: MagicMock) -> None: redshift_connector = RedshiftConnector() mock_user_config_dir.assert_called_once_with('pypandasql') mock_keyring_get_password.assert_called_once_with( 'pypandasql-redshift', 'test') with self.assertRaises(AssertionError): redshift_connector.get_engine(schema='')
def test_get_engine(self, mock_create_engine: MagicMock, mock_keyring_get_password: MagicMock, mock_user_config_dir: MagicMock) -> None: redshift_connector = RedshiftConnector() redshift_connector.get_engine(schema='test-schema') mock_user_config_dir.assert_called_once_with('pypandasql') mock_keyring_get_password.assert_called_once_with( 'pypandasql-redshift', 'test') mock_create_engine.assert_called_once_with( 'redshift+psycopg2://test:random-password@' 'test-host:1234/test-schema')