Commit 6de60631 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove duplicate code here too

parent 6f001435
......@@ -109,35 +109,21 @@ ExportCalendarsJobInterfaceTest::ExportCalendarsJobInterfaceTest(QObject *parent
{
}
void ExportCalendarsJobInterfaceTest::exportCalendarConfig_data()
void ExportCalendarsJobInterfaceTest::exportCalendar_data()
{
QTest::addColumn<QByteArray>("configpath");
QTest::addColumn<Utils::StoredTypes>("options");
Utils::StoredTypes options = {Utils::StoredType::Config};
const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/export/");
QTest::newRow("calendaronlyconfig") << pathConfig + QByteArray("calendaronlyconfig/");
QTest::newRow("calendaronlyconfig") << pathConfig + QByteArray("calendaronlyconfig/") << options;
options = {Utils::StoredType::Config|Utils::StoredType::Resources};
QTest::newRow("calendarconfigandresources") << pathConfig + QByteArray("calendarconfigandresources/") << options;
}
void ExportCalendarsJobInterfaceTest::exportCalendarConfig()
{
QFETCH(QByteArray, configpath);
TestExportFile *file = new TestExportFile(this);
file->setPathConfig(configpath);
ExportCalendarsJobInterfaceTestImpl *impl = new ExportCalendarsJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
impl->setPathConfig(QLatin1String(configpath));
file->setAbstractImportExportJob(impl);
file->start();
delete impl;
}
void ExportCalendarsJobInterfaceTest::exportCalendarConfigAndResource_data()
{
QTest::addColumn<QByteArray>("configpath");
const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/export/");
QTest::newRow("calendarconfigandresources") << pathConfig + QByteArray("calendarconfigandresources/");
}
void ExportCalendarsJobInterfaceTest::exportCalendarConfigAndResource()
void ExportCalendarsJobInterfaceTest::exportCalendar()
{
QFETCH(QByteArray, configpath);
QFETCH(Utils::StoredTypes, options);
TestExportFile *file = new TestExportFile(this);
file->setPathConfig(configpath);
QVector<Utils::AkonadiInstanceInfo> lstInfo;
......@@ -150,7 +136,7 @@ void ExportCalendarsJobInterfaceTest::exportCalendarConfigAndResource()
info.identifier = QStringLiteral("akonadi_kontact_resource_2");
lstInfo << info;
ExportCalendarsJobInterfaceTestImpl *exportNote = new ExportCalendarsJobInterfaceTestImpl(this, {Utils::StoredType::Config|Utils::StoredType::Resources}, file->archiveStorage(), 1);
ExportCalendarsJobInterfaceTestImpl *exportNote = new ExportCalendarsJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
exportNote->setListOfResource(lstInfo);
exportNote->setPathConfig(QLatin1String(configpath));
file->setAbstractImportExportJob(exportNote);
......
......@@ -51,11 +51,8 @@ public:
explicit ExportCalendarsJobInterfaceTest(QObject *parent = nullptr);
~ExportCalendarsJobInterfaceTest() = default;
private Q_SLOTS:
void exportCalendarConfig_data();
void exportCalendarConfig();
void exportCalendarConfigAndResource_data();
void exportCalendarConfigAndResource();
void exportCalendar_data();
void exportCalendar();
};
#endif // EXPORTCALENDARSJOBINTERFACETEST_H
......@@ -73,23 +73,27 @@ ImportCalendarJobInterfaceTest::ImportCalendarJobInterfaceTest(QObject *parent)
{
}
void ImportCalendarJobInterfaceTest::importCalendarConfig_data()
void ImportCalendarJobInterfaceTest::importCalendar_data()
{
QTest::addColumn<QString>("zipFilePath");
QTest::addColumn<QString>("testPath");
QTest::addColumn<Utils::StoredTypes>("options");
Utils::StoredTypes options = {Utils::StoredType::Config};
const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/import/");
QTest::newRow("calendaronlyconfig") << QString::fromLatin1(pathConfig) << QStringLiteral("/calendaronlyconfig/");
QTest::newRow("calendaronlyconfig") << QString::fromLatin1(pathConfig) << QStringLiteral("/calendaronlyconfig/") << options;
}
void ImportCalendarJobInterfaceTest::importCalendarConfig()
void ImportCalendarJobInterfaceTest::importCalendar()
{
QFETCH(QString, zipFilePath);
QFETCH(QString, testPath);
QFETCH(Utils::StoredTypes, options);
TestImportFile *file = new TestImportFile(zipFilePath + testPath, this);
file->setPathConfig(zipFilePath + testPath);
file->setExtractPath(QDir::tempPath() + testPath);
file->setExcludePath(Utils::calendarPath());
ImportCalendarJobInterfaceTestImpl *impl = new ImportCalendarJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
ImportCalendarJobInterfaceTestImpl *impl = new ImportCalendarJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
......
......@@ -47,8 +47,8 @@ public:
explicit ImportCalendarJobInterfaceTest(QObject *parent = nullptr);
~ImportCalendarJobInterfaceTest() = default;
private Q_SLOTS:
void importCalendarConfig();
void importCalendarConfig_data();
void importCalendar();
void importCalendar_data();
};
#endif // IMPORTCALENDARJOBINTERFACETEST_H
......@@ -87,8 +87,8 @@ void ImportMailJobInterfaceTest::importMailConfig_data()
QTest::addColumn<QString>("zipFilePath");
QTest::addColumn<QString>("testPath");
QTest::addColumn<Utils::StoredTypes>("options");
const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/import/");
Utils::StoredTypes options = {Utils::StoredType::Config};
const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/import/");
QTest::newRow("mailonlyconfig") << QString::fromLatin1(pathConfig) << QStringLiteral("/mailonlyconfig/") << options;
}
......
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