avoid modifying real configuration file: use temp folder
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 24 Nov 2022 15:02:02 +0000 (16:02 +0100)
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>
Fri, 25 Nov 2022 08:07:02 +0000 (09:07 +0100)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
test/testcfapishellextensionsipc.cpp

index 4aec97b579eb08b11780d15ad3d79dc38be44b84..cc7016ec289739bbbe43b98837a04c8184f2d656 100644 (file)
@@ -165,6 +165,9 @@ public:
 private slots:
     void initTestCase()
     {
+        QTemporaryDir dir;
+        ConfigFile::setConfDir(dir.path());
+
         VfsShellExtensions::ThumbnailProviderIpc::overrideServerName = VfsShellExtensions::serverNameForApplicationNameDefault();
         VfsShellExtensions::CustomStateProviderIpc::overrideServerName = VfsShellExtensions::serverNameForApplicationNameDefault();
 
@@ -258,6 +261,9 @@ private slots:
 
     void testRequestThumbnails()
     {
+        QTemporaryDir dir;
+        ConfigFile::setConfDir(dir.path());
+
         FolderMan *folderman = FolderMan::instance();
         QVERIFY(folderman);
         auto folder = FolderMan::instance()->folderForPath(fakeFolder.localPath());
@@ -338,6 +344,9 @@ private slots:
 
     void testRequestCustomStates()
     {
+        QTemporaryDir dir;
+        ConfigFile::setConfDir(dir.path());
+
         FolderMan *folderman = FolderMan::instance();
         QVERIFY(folderman);
         auto folder = FolderMan::instance()->folderForPath(fakeFolder.localPath());
@@ -469,6 +478,9 @@ private slots:
 
     void cleanupTestCase()
     {
+        QTemporaryDir dir;
+        ConfigFile::setConfDir(dir.path());
+
         VfsShellExtensions::ThumbnailProviderIpc::overrideServerName.clear();
 
         if (auto folder = FolderMan::instance()->folderForPath(fakeFolder.localPath())) {