mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Add a test case for unwriteable folders in file downloader
Attempt to verify bug 17410 Identify tool->download in a not authorised folder block qgis The test passes, so let's push it in, I'll continue to investigate if there is an issue in the GUI logic.
This commit is contained in:
parent
e781ad2e3e
commit
f06ea878b8
@ -17,6 +17,7 @@
|
||||
#include "qgstest.h"
|
||||
#include <QObject>
|
||||
#include <QTemporaryFile>
|
||||
#include <QTemporaryDir>
|
||||
#include <QUrl>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
@ -73,6 +74,7 @@ class TestQgsFileDownloader: public QObject
|
||||
void testCanceledDownload();
|
||||
void testInvalidUrl();
|
||||
void testBlankUrl();
|
||||
void testLacksWritePermissionsError();
|
||||
#ifndef QT_NO_SSL
|
||||
void testSslError_data();
|
||||
void testSslError();
|
||||
@ -236,6 +238,22 @@ void TestQgsFileDownloader::testSslError()
|
||||
QVERIFY( !mCanceled );
|
||||
}
|
||||
|
||||
void TestQgsFileDownloader::testLacksWritePermissionsError()
|
||||
{
|
||||
QTemporaryDir dir;
|
||||
QFile tmpDir( dir.path( ) );
|
||||
tmpDir.setPermissions( tmpDir.permissions() & !( QFile::Permission::WriteGroup | QFile::Permission::WriteUser | QFile::Permission::WriteOther | QFile::Permission::WriteOwner ) );
|
||||
QVERIFY( ! tmpDir.isWritable() );
|
||||
QString fileName( dir.path() + '/' + QStringLiteral( "tmp.bin" ) );
|
||||
makeCall( QUrl( QStringLiteral( "http://www.qgis.org" ) ), fileName );
|
||||
QVERIFY( mExited );
|
||||
QVERIFY( !mCompleted );
|
||||
QVERIFY( mError );
|
||||
QVERIFY( !mCanceled );
|
||||
QVERIFY( ! QFileInfo( fileName ).exists( ) );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user