Commit d13bcc81 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Generate unique name for test too

parent df3179e2
Pipeline #21390 passed with stage
in 12 minutes and 26 seconds
......@@ -89,10 +89,11 @@ QString ImportMailJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResour
void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid)
{
const QString uniqueName = uniqueIdentityName(name);
qDebug() << " void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) not implemented yet" << oldUid << " name " << name;
KIdentityManagement::Identity identity;
identity.setUoid(mIdentityUoid++);
group.writeEntry(QStringLiteral("Name"), name);
group.writeEntry(QStringLiteral("Name"), uniqueName);
group.sync();
identity.readConfig(group);
......@@ -110,6 +111,20 @@ void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfig
//mIdentityManager->commit();
}
QString ImportMailJobInterfaceTestImpl::uniqueIdentityName(const QString &name)
{
QString newName(name);
int i = 0;
const QStringList existingIdentityNames{QStringLiteral("identity1"), QStringLiteral("identity2")};
while (!existingIdentityNames.contains(newName)) {
newName = QStringLiteral("%1_%2").arg(name).arg(i);
++i;
}
return newName;
}
void ImportMailJobInterfaceTestImpl::importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId)
{
qDebug() << "importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) not implemented yet";
......
......@@ -46,6 +46,7 @@ protected:
void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override;
void importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) override;
private:
Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name);
uint mIdentityUoid = 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