teste2eserversetup.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) by Claudio Cambra <claudio.cambra@nextcloud.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. #include <QObject>
  15. #include <QTest>
  16. #include <QSignalSpy>
  17. #include "gui/accountstate.h"
  18. #include "endtoendtestutils.h"
  19. class E2eServerSetupTest : public QObject
  20. {
  21. Q_OBJECT
  22. public:
  23. E2eServerSetupTest() = default;
  24. private:
  25. EndToEndTestHelper _helper;
  26. private slots:
  27. void initTestCase()
  28. {
  29. QSignalSpy accountReady(&_helper, &EndToEndTestHelper::accountReady);
  30. _helper.startAccountConfig();
  31. QVERIFY(accountReady.wait(3000));
  32. const auto accountState = _helper.accountState();
  33. QSignalSpy accountConnected(accountState.data(), &OCC::AccountState::isConnectedChanged);
  34. QVERIFY(accountConnected.wait(30000));
  35. }
  36. void testBasicPropfind()
  37. {
  38. const auto account = _helper.account();
  39. auto job = new OCC::PropfindJob(account, "/", this);
  40. QSignalSpy result(job, &OCC::PropfindJob::result);
  41. job->setProperties(QList<QByteArray>() << "getlastmodified");
  42. job->start();
  43. QVERIFY(result.wait(10000));
  44. }
  45. };
  46. QTEST_MAIN(E2eServerSetupTest)
  47. #include "teste2eserversetup.moc"