testremotewipe.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * This software is in the public domain, furnished "as is", without technical
  3. * support, and with no warranty, express or implied, as to its usefulness for
  4. * any purpose.
  5. *
  6. */
  7. #include <qglobal.h>
  8. #include <QTemporaryDir>
  9. #include <QtTest>
  10. #include "remotewipe.h"
  11. #include "common/utility.h"
  12. #include "folderman.h"
  13. #include "account.h"
  14. #include "accountstate.h"
  15. #include "configfile.h"
  16. #include "testhelper.h"
  17. using namespace OCC;
  18. class TestRemoteWipe: public QObject
  19. {
  20. Q_OBJECT
  21. private slots:
  22. // TODO
  23. void testWipe(){
  24. // QTemporaryDir dir;
  25. // ConfigFile::setConfDir(dir.path()); // we don't want to pollute the user's config file
  26. // QVERIFY(dir.isValid());
  27. // QDir dirToRemove(dir.path());
  28. // QVERIFY(dirToRemove.mkpath("nextcloud"));
  29. // QString dirPath = dirToRemove.canonicalPath();
  30. // AccountPtr account = Account::create();
  31. // QVERIFY(account);
  32. // auto manager = AccountManager::instance();
  33. // QVERIFY(manager);
  34. // AccountState *newAccountState = manager->addAccount(account);
  35. // manager->save();
  36. // QVERIFY(newAccountState);
  37. // QUrl url("http://example.de");
  38. // HttpCredentialsTest *cred = new HttpCredentialsTest("testuser", "secret");
  39. // account->setCredentials(cred);
  40. // account->setUrl( url );
  41. // FolderMan *folderman = FolderMan::instance();
  42. // folderman->addFolder(newAccountState, folderDefinition(dirPath + "/sub/nextcloud/"));
  43. // // check if account exists
  44. // qDebug() << "Does account exists?!";
  45. // QVERIFY(!account->id().isEmpty());
  46. // manager->deleteAccount(newAccountState);
  47. // manager->save();
  48. // // check if account exists
  49. // qDebug() << "Does account exists yet?!";
  50. // QVERIFY(account);
  51. // // check if folder exists
  52. // QVERIFY(dirToRemove.exists());
  53. // // remote folders
  54. // qDebug() << "Removing folder for account " << newAccountState->account()->url();
  55. // folderman->slotWipeFolderForAccount(newAccountState);
  56. // // check if folders dont exist anymore
  57. // QCOMPARE(dirToRemove.exists(), false);
  58. }
  59. };
  60. QTEST_APPLESS_MAIN(TestRemoteWipe)
  61. #include "testremotewipe.moc"