Commit 41bc1c2f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement mail autotest

parent 2e38a571
Pipeline #21356 passed with stage
in 12 minutes and 52 seconds
......@@ -33,7 +33,7 @@ ImportAddressbookJobInterfaceTestImpl::ImportAddressbookJobInterfaceTestImpl(QOb
ImportAddressbookJobInterfaceTestImpl::~ImportAddressbookJobInterfaceTestImpl()
{
//Clean up temp repo
QVERIFY(QDir(QDir::tempPath() + QLatin1Char('/') + Utils::storeAddressbook()).removeRecursively());
QVERIFY(QDir(extractPath()).removeRecursively());
}
Akonadi::Collection::Id ImportAddressbookJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
......@@ -98,6 +98,7 @@ void ImportAddressbookJobInterfaceTest::importAddressbook()
file->setExcludePath(Utils::addressbookPath());
ImportAddressbookJobInterfaceTestImpl *impl = new ImportAddressbookJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExtractPath(file->extractPath());
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
......
......@@ -48,3 +48,13 @@ QString ExportImportUtil::loggingFilePath() const
{
return mLogCreateResource->logPath();
}
void ExportImportUtil::setExtractPath(const QString &extractPath)
{
mExtractPath = extractPath;
}
QString ExportImportUtil::extractPath() const
{
return mExtractPath;
}
......@@ -35,8 +35,14 @@ public:
QVector<Utils::AkonadiInstanceInfo> mListAkonadiInstanceInfo;
QString mPathConfig;
void setExtractPath(const QString &extractPath);
Q_REQUIRED_RESULT QString extractPath() const;
protected:
LogCreatingResource *mLogCreateResource = nullptr;
private:
QString mExtractPath;
};
#endif // EXPORTIMPORTUTIL_H
......@@ -35,8 +35,15 @@ ImportMailJobInterfaceTestImpl::ImportMailJobInterfaceTestImpl(QObject *parent,
ImportMailJobInterfaceTestImpl::~ImportMailJobInterfaceTestImpl()
{
//Clean up temp repo
QVERIFY(QDir(QDir::tempPath() + QLatin1Char('/') + Utils::storeMails()).removeRecursively());
//Clean up temp repo. FIXME !
QVERIFY(QDir(extractPath()).removeRecursively());
}
void ImportMailJobInterfaceTestImpl::start()
{
QDir().mkpath(extractPath());
//Create temporary file for identities
ImportMailJobInterface::start();
}
Akonadi::Collection::Id ImportMailJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
......@@ -149,9 +156,12 @@ void ImportMailJobInterfaceTest::importMail()
file->setExcludePath(Utils::mailsPath()); // ???
ImportMailJobInterfaceTestImpl *impl = new ImportMailJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExtractPath(file->extractPath());
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
delete impl;
delete file;
}
......@@ -31,6 +31,7 @@ class ImportMailJobInterfaceTestImpl : public ImportMailJobInterface, public Exp
public:
explicit ImportMailJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep);
~ImportMailJobInterfaceTestImpl();
void start() override;
protected:
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
......@@ -47,6 +48,7 @@ protected:
void importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) override;
private:
uint mIdentityUoid = 1;
};
class ImportMailJobInterfaceTest : public QObject
......
......@@ -141,3 +141,8 @@ void TestImportFile::setLoggingFilePath(const QString &loggingFilePath)
{
mLoggingFilePath = loggingFilePath;
}
QString TestImportFile::extractPath() const
{
return mExtractPath;
}
......@@ -48,6 +48,8 @@ public:
Q_REQUIRED_RESULT QString loggingFilePath() const;
void setLoggingFilePath(const QString &loggingFilePath);
Q_REQUIRED_RESULT QString extractPath() const;
private:
AbstractImportExportJob *mAbstractImportExportJob = nullptr;
ArchiveStorage *mArchiveStorage = nullptr;
......
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