Commit 0c5f8dc9 authored by Stephane Mankowski's avatar Stephane Mankowski

Correction in unit test

parent 947eacbe
......@@ -2260,7 +2260,7 @@ SKGError SKGUnitObject::downloadUnitValue(UnitDownloadMode iMode, int iNbMaxValu
code.remove(QStringLiteral(" /"));
QString source = getDownloadSource();
auto* doc = qobject_cast<SKGDocumentBank*>(getDocument());
if (!code.trimmed().isEmpty() && !source.trimmed().isEmpty() && (doc != nullptr)) {
if (!code.trimmed().isEmpty() && (doc != nullptr)) {
// Get last date
QDate firstDate;
SKGStringListList result;
......@@ -2311,7 +2311,7 @@ SKGError SKGUnitObject::downloadUnitValue(UnitDownloadMode iMode, int iNbMaxValu
IFOKDO(err, val.setQuantity(value))
IFOKDO(err, val.save())
}
} else {
} else if(!source.trimmed().isEmpty()){
// Quote download
// Set 1st january 1970 if date is not found
......
......@@ -370,23 +370,7 @@ int main(int argc, char** argv)
SKGObjectBase::SKGListSKGObjectBase values;
SKGTESTERROR(QStringLiteral("UNIT:getUnitValues"), unit1.getUnitValues(values), true)
SKGTESTBOOL("UNIT:getUnitValues", (!values.isEmpty()), true)
}
}
{
// Unit download
SKGDocumentBank document1;
SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
SKGError err;
SKGUnitObject unit1(&document1);
{
SKGBEGINTRANSACTION(document1, QStringLiteral("UNIT"), err)
SKGTESTERROR(QStringLiteral("UNIT:createCurrencyUnit"), SKGUnitObject::createCurrencyUnit(&document1, QStringLiteral("Bitcoin"), unit1), true)
SKGTESTERROR(QStringLiteral("UNIT:downloadUnitValue"), unit1.downloadUnitValue(SKGUnitObject::LAST), true)
SKGObjectBase::SKGListSKGObjectBase values;
SKGTESTERROR(QStringLiteral("UNIT:getUnitValues"), unit1.getUnitValues(values), true)
SKGTESTBOOL("UNIT:getUnitValues", (!values.isEmpty()), true)
SKGTESTBOOL("UNIT:getUnitValues.isEmpty", values.isEmpty(), false)
}
}
{
......
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