def test_get_uri_with_missing_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_uri(schema=None)
def test_get_uri(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') self.assertEqual( redshift_connector.get_uri(schema='test-schema'), 'redshift+psycopg2://test:random-password@test-host:1234/test-schema' )