filterplaintest.cpp 1.19 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
  SPDX-FileCopyrightText: 2017-2021 Laurent Montel <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3

4
  SPDX-License-Identifier: GPL-2.0-only
Laurent Montel's avatar
Laurent Montel committed
5 6 7 8 9
*/

#include "filterplaintest.h"
#include <MailImporter/FilterPlain>
#include "filterimportertest.h"
Laurent Montel's avatar
Laurent Montel committed
10
#include <QTest>
Laurent Montel's avatar
Laurent Montel committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

FilterPlainTest::FilterPlainTest(QObject *parent)
    : QObject(parent)
{
}

FilterPlainTest::~FilterPlainTest()
{
}

void FilterPlainTest::shouldImportData()
{
}

void FilterPlainTest::canNotImportDataEmptyPath()
{
    MailImporter::FilterPlain filter;
Laurent Montel's avatar
Laurent Montel committed
28
    MailImporter::FilterInfo info;
Laurent Montel's avatar
Laurent Montel committed
29
    auto *importerTest = new FilterImporterTest(&info);
Laurent Montel's avatar
Laurent Montel committed
30
    filter.setFilterImporter(importerTest);
Laurent Montel's avatar
Laurent Montel committed
31
    filter.setFilterInfo(&info);
Laurent Montel's avatar
Laurent Montel committed
32 33
    filter.importMails(QString());
    QVERIFY(importerTest->filterImporterDataList().isEmpty());
Laurent Montel's avatar
Laurent Montel committed
34
    delete importerTest;
Laurent Montel's avatar
Laurent Montel committed
35 36 37 38 39
}

void FilterPlainTest::canNotImportDataUnknowPath()
{
    MailImporter::FilterPlain filter;
Laurent Montel's avatar
Laurent Montel committed
40
    MailImporter::FilterInfo info;
Laurent Montel's avatar
Laurent Montel committed
41
    auto *importerTest = new FilterImporterTest(&info);
Laurent Montel's avatar
Laurent Montel committed
42
    filter.setFilterImporter(importerTest);
Laurent Montel's avatar
Laurent Montel committed
43
    filter.setFilterInfo(&info);
Laurent Montel's avatar
Laurent Montel committed
44 45
    filter.importMails(QStringLiteral("/foo/kde/bla/toto/"));
    QVERIFY(importerTest->filterImporterDataList().isEmpty());
Laurent Montel's avatar
Laurent Montel committed
46
    delete importerTest;
Laurent Montel's avatar
Laurent Montel committed
47 48 49
}

QTEST_MAIN(FilterPlainTest)