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 ...@@ -89,10 +89,11 @@ QString ImportMailJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResour
void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) 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; qDebug() << " void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) not implemented yet" << oldUid << " name " << name;
KIdentityManagement::Identity identity; KIdentityManagement::Identity identity;
identity.setUoid(mIdentityUoid++); identity.setUoid(mIdentityUoid++);
group.writeEntry(QStringLiteral("Name"), name); group.writeEntry(QStringLiteral("Name"), uniqueName);
group.sync(); group.sync();
identity.readConfig(group); identity.readConfig(group);
...@@ -110,6 +111,20 @@ void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfig ...@@ -110,6 +111,20 @@ void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfig
//mIdentityManager->commit(); //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) 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"; qDebug() << "importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) not implemented yet";
......
...@@ -46,6 +46,7 @@ protected: ...@@ -46,6 +46,7 @@ protected:
void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override; void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override;
void importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) override; void importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) override;
private: private:
Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name);
uint mIdentityUoid = 1; 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