Changeset View
Changeset View
Standalone View
Standalone View
autotests/drive/drivetestutils.cpp
Show All 17 Lines | |||||
18 | * License along with this library. If not, see <https://www.gnu.org/licenses/>. | 18 | * License along with this library. If not, see <https://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "driveservice.h" | 21 | #include "driveservice.h" | ||
22 | #include "about.h" | 22 | #include "about.h" | ||
23 | #include "change.h" | 23 | #include "change.h" | ||
24 | #include "file.h" | 24 | #include "file.h" | ||
25 | #include "teamdrive.h" | 25 | #include "teamdrive.h" | ||
26 | #include "drives.h" | ||||
26 | #include "testutils.h" | 27 | #include "testutils.h" | ||
27 | 28 | | |||
28 | #include <QFile> | 29 | #include <QFile> | ||
29 | 30 | | |||
30 | KGAPI2::Drive::AboutPtr aboutFromFile(const QString &path) | 31 | KGAPI2::Drive::AboutPtr aboutFromFile(const QString &path) | ||
31 | { | 32 | { | ||
32 | QFile f(path); | 33 | QFile f(path); | ||
33 | VERIFY_RET(f.open(QIODevice::ReadOnly), {}); | 34 | VERIFY_RET(f.open(QIODevice::ReadOnly), {}); | ||
Show All 18 Lines | 52 | { | |||
52 | QFile f(path); | 53 | QFile f(path); | ||
53 | VERIFY_RET(f.open(QIODevice::ReadOnly), {}); | 54 | VERIFY_RET(f.open(QIODevice::ReadOnly), {}); | ||
54 | 55 | | |||
55 | auto file = KGAPI2::Drive::File::fromJSON(f.readAll()); | 56 | auto file = KGAPI2::Drive::File::fromJSON(f.readAll()); | ||
56 | VERIFY_RET(file, {}); | 57 | VERIFY_RET(file, {}); | ||
57 | return file; | 58 | return file; | ||
58 | } | 59 | } | ||
59 | 60 | | |||
61 | KGAPI2::Drive::DrivesPtr drivesFromFile(const QString &path) | ||||
62 | { | ||||
63 | QFile f(path); | ||||
64 | VERIFY_RET(f.open(QIODevice::ReadOnly), {}); | ||||
65 | | ||||
66 | auto drives = KGAPI2::Drive::Drives::fromJSON(f.readAll()); | ||||
67 | VERIFY_RET(drives, {}); | ||||
68 | return drives; | ||||
69 | } | ||||
70 | | ||||
60 | KGAPI2::Drive::TeamdrivePtr teamdriveFromFile(const QString &path) | 71 | KGAPI2::Drive::TeamdrivePtr teamdriveFromFile(const QString &path) | ||
61 | { | 72 | { | ||
62 | QFile f(path); | 73 | QFile f(path); | ||
63 | VERIFY_RET(f.open(QIODevice::ReadOnly), {}); | 74 | VERIFY_RET(f.open(QIODevice::ReadOnly), {}); | ||
64 | 75 | | |||
65 | auto teamdrive = KGAPI2::Drive::Teamdrive::fromJSON(f.readAll()); | 76 | auto teamdrive = KGAPI2::Drive::Teamdrive::fromJSON(f.readAll()); | ||
66 | VERIFY_RET(teamdrive, {}); | 77 | VERIFY_RET(teamdrive, {}); | ||
67 | return teamdrive; | 78 | return teamdrive; | ||
68 | } | 79 | } |