Skip to content

Commit

Permalink
Adding unit tests on the new clip --best option
Browse files Browse the repository at this point in the history
  • Loading branch information
lerignoux committed Jul 25, 2020
1 parent 07f6f09 commit 0b96ca9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/TestCli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,22 @@ void TestCli::testClip()
setInput("a");
execCmd(clipCmd, {"clip", m_dbFile2->fileName(), "--attribute", "Username", "--totp", "/Sample Entry"});
QVERIFY(m_stderr->readAll().contains("ERROR: Please specify one of --attribute or --totp, not both.\n"));

// Best option
setInput("a");
execCmd(clipCmd, {"clip", m_dbFile->fileName(), "/Sample", "-b"});
QCOMPARE(m_stderr->readAll(), QByteArray());
QCOMPARE(m_stdout->readAll(), QByteArray());
QVERIFY(clipCmd.name.isEmpty());
QVERIFY(m_stderr->readAll().contains("Sample Entry"));
QVERIFY(m_stderr->readAll().contains("Sample Entry 1"));
QVERIFY(m_stderr->readAll().contains("Sample Entry 2"));

setInput("a");
execCmd(clipCmd, {"clip", m_dbFile->fileName(), "/Entry 1", "-b"});
QCOMPARE(m_stderr->readAll(), QByteArray());
QCOMPARE(m_stdout->readAll(), QByteArray());
QTRY_COMPARE(clipboard->text(), QString("Password"));
}

void TestCli::testCreate()
Expand Down

0 comments on commit 0b96ca9

Please sign in to comment.