diff options
author | louib <L0U13@protonmail.com> | 2019-10-28 20:27:29 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2019-11-02 05:53:54 +0300 |
commit | f4d6b4d13ae810cf1ce231cb03f98106149b9bc7 (patch) | |
tree | f3edb5651514d9fdb0e50f2b5c537daea30bab33 /tests | |
parent | 98badfb4a2e69df7666839d097c577d6df13a9ed (diff) |
CLI: do not display protected fields by default.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/TestCli.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/TestCli.cpp b/tests/TestCli.cpp index f1f39e9f5..8a9ab50ce 100644 --- a/tests/TestCli.cpp +++ b/tests/TestCli.cpp @@ -1682,14 +1682,15 @@ void TestCli::testShow() QCOMPARE(m_stdoutFile->readAll(), QByteArray("Title: Sample Entry\n" "UserName: User Name\n" - "Password: Password\n" + "Password: PROTECTED\n" "URL: http://www.somesite.com/\n" "Notes: Notes\n")); qint64 pos = m_stdoutFile->pos(); Utils::Test::setNextPassword("a"); - showCmd.execute({"show", m_dbFile->fileName(), "-q", "/Sample Entry"}); + showCmd.execute({"show", "-s", m_dbFile->fileName(), "/Sample Entry"}); m_stdoutFile->seek(pos); + m_stdoutFile->readLine(); // skip password prompt QCOMPARE(m_stdoutFile->readAll(), QByteArray("Title: Sample Entry\n" "UserName: User Name\n" @@ -1699,6 +1700,17 @@ void TestCli::testShow() pos = m_stdoutFile->pos(); Utils::Test::setNextPassword("a"); + showCmd.execute({"show", m_dbFile->fileName(), "-q", "/Sample Entry"}); + m_stdoutFile->seek(pos); + QCOMPARE(m_stdoutFile->readAll(), + QByteArray("Title: Sample Entry\n" + "UserName: User Name\n" + "Password: PROTECTED\n" + "URL: http://www.somesite.com/\n" + "Notes: Notes\n")); + + pos = m_stdoutFile->pos(); + Utils::Test::setNextPassword("a"); showCmd.execute({"show", "-a", "Title", m_dbFile->fileName(), "/Sample Entry"}); m_stdoutFile->seek(pos); m_stdoutFile->readLine(); // skip password prompt @@ -1706,6 +1718,13 @@ void TestCli::testShow() pos = m_stdoutFile->pos(); Utils::Test::setNextPassword("a"); + showCmd.execute({"show", "-a", "Password", m_dbFile->fileName(), "/Sample Entry"}); + m_stdoutFile->seek(pos); + m_stdoutFile->readLine(); // skip password prompt + QCOMPARE(m_stdoutFile->readAll(), QByteArray("Password\n")); + + pos = m_stdoutFile->pos(); + Utils::Test::setNextPassword("a"); showCmd.execute({"show", "-a", "Title", "-a", "URL", m_dbFile->fileName(), "/Sample Entry"}); m_stdoutFile->seek(pos); m_stdoutFile->readLine(); // skip password prompt |