Improve CSV export and import capability

* Fixes #3541
* CSV export now includes TOTP settings, Entry Icon (database icon number only), Modified Time, and Created Time.
* CSV import properly understands time in ISO 8601 format and Unix Timestamp.
* CSV import will set the TOTP settings and entry icon based on the chosen column.
This commit is contained in:
Jonathan White 2020-08-26 15:17:31 -04:00
parent f49f62d3be
commit f947c96462
7 changed files with 189 additions and 76 deletions

View file

@ -943,10 +943,10 @@ void TestCli::testExport()
setInput("a");
execCmd(exportCmd, {"export", "-f", "csv", m_dbFile->fileName()});
QByteArray csvHeader = m_stdout->readLine();
QCOMPARE(csvHeader, QByteArray("\"Group\",\"Title\",\"Username\",\"Password\",\"URL\",\"Notes\"\n"));
QVERIFY(csvHeader.contains(QByteArray("\"Group\",\"Title\",\"Username\",\"Password\",\"URL\",\"Notes\"")));
QByteArray csvData = m_stdout->readAll();
QVERIFY(csvData.contains(QByteArray(
"\"NewDatabase\",\"Sample Entry\",\"User Name\",\"Password\",\"http://www.somesite.com/\",\"Notes\"\n")));
"\"NewDatabase\",\"Sample Entry\",\"User Name\",\"Password\",\"http://www.somesite.com/\",\"Notes\"")));
// test invalid format
setInput("a");