Commit 9b8cce2e authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Calendar: fix tests

The tests were using UID/ID in a wrong way, too.
parent 52eb4116
......@@ -21,6 +21,7 @@ Content-Type: application/json
"dateTime": "2018-04-01T09:30:00Z",
"timeZone": "UTC+02:00"
},
"iCalUID": "3if6lf59tove1e037baa75l54t@google.com",
"kind": "calendar#event",
"location": "Meeting Room",
"organizer": {
......
......@@ -21,6 +21,7 @@ Content-Type: application/json
"dateTime": "2018-04-01T09:30:00Z",
"timeZone": "UTC+02:00"
},
"iCalUID": "3if6lf59tove1e037baa75l54t@google.com",
"id": "3if6lf59tove1e037baa75l54t",
"kind": "calendar#event",
"location": "Meeting Room",
......
......@@ -14,6 +14,7 @@ Content-Type: application/json
"end": {
"date": "2018-04-23"
},
"iCalUID": "009c2cc9-0781-482d-8ccd-8fc9bfeb3138",
"kind": "calendar#event",
"location": "Toulouse, France",
"organizer": {
......
......@@ -14,6 +14,7 @@ Content-Type: application/json
"end": {
"date": "2018-04-23"
},
"iCalUID": "009c2cc9-0781-482d-8ccd-8fc9bfeb3138",
"id": "_60o3iopicdhjib9g6ss32b9k70p68b9ocdhm8b9ocphjioj6clh36c9j70",
"kind": "calendar#event",
"location": "Toulouse, France",
......
......@@ -52,7 +52,6 @@ private Q_SLOTS:
auto event1 = eventFromFile(QFINDTESTDATA("data/event1.json"));
auto response1 = EventPtr::create(*event1);
event1->setUid({});
QTest::newRow("simple event")
<< QList<FakeNetworkAccessManager::Scenario>{
scenarioFromFile(QFINDTESTDATA("data/event1_create_request.txt"),
......@@ -63,7 +62,6 @@ private Q_SLOTS:
auto event2 = eventFromFile(QFINDTESTDATA("data/event2.json"));
auto response2 = EventPtr::create(*event2);
event2->setUid({});
QTest::newRow("batch create")
<< QList<FakeNetworkAccessManager::Scenario>{
scenarioFromFile(QFINDTESTDATA("data/event1_create_request.txt"),
......
......@@ -48,7 +48,7 @@ private Q_SLOTS:
{
QTest::addColumn<QList<FakeNetworkAccessManager::Scenario>>("scenarios");
QTest::addColumn<EventsList>("events");
QTest::addColumn<bool>("uidOnly");
QTest::addColumn<bool>("idOnly");
QTest::newRow("simple event")
<< QList<FakeNetworkAccessManager::Scenario>{
......@@ -97,21 +97,21 @@ private Q_SLOTS:
{
QFETCH(QList<FakeNetworkAccessManager::Scenario>, scenarios);
QFETCH(EventsList, events);
QFETCH(bool, uidOnly);
QFETCH(bool, idOnly);
FakeNetworkAccessManagerFactory::get()->setScenarios(scenarios);
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
EventDeleteJob *job = nullptr;
if (events.count() == 1) {
if (uidOnly) {
job = new EventDeleteJob(events.at(0)->uid(), QStringLiteral("MockAccount"), account, nullptr);
if (idOnly) {
job = new EventDeleteJob(events.at(0)->id(), QStringLiteral("MockAccount"), account, nullptr);
} else {
job = new EventDeleteJob(events.at(0), QStringLiteral("MockAccount"), account, nullptr);
}
} else {
if (uidOnly) {
job = new EventDeleteJob(elementsToUids(events), QStringLiteral("MockAccount"), account, nullptr);
if (idOnly) {
job = new EventDeleteJob(elementsToIds(events), QStringLiteral("MockAccount"), account, nullptr);
} else {
job = new EventDeleteJob(events, QStringLiteral("MockAccount"), account, nullptr);
}
......
......@@ -80,7 +80,7 @@ private Q_SLOTS:
const auto event = eventFromFile(QFINDTESTDATA("data/event1.json"));
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
auto job = new EventFetchJob(event->uid(), QStringLiteral("MockAccount"), account);
auto job = new EventFetchJob(event->id(), QStringLiteral("MockAccount"), account);
QVERIFY(execJob(job));
const auto items = job->items();
QCOMPARE(items.count(), 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment