diff options
author | Roland Reichwein <mail@reichwein.it> | 2023-01-05 19:47:05 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2023-01-05 19:47:05 +0100 |
commit | e8a7c88b6cedbd05b183e85dff74c513bfcd774e (patch) | |
tree | 5d0fe8c8b387ca4846b0ec76a4955aa92c363f21 /tests/test-auth.cpp | |
parent | d2690b7c3639cc1555b34d002de782976cbb6845 (diff) |
Test config.cpp
Diffstat (limited to 'tests/test-auth.cpp')
-rw-r--r-- | tests/test-auth.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test-auth.cpp b/tests/test-auth.cpp index 8397b35..37bc02f 100644 --- a/tests/test-auth.cpp +++ b/tests/test-auth.cpp @@ -18,7 +18,16 @@ class AuthFixture public: AuthFixture(){} ~AuthFixture(){} - void setup(){} + void setup() + { + int filedes[2]; + if (pipe(filedes) == -1) + throw std::runtime_error("Pipe error"); + if (close(2) == -1) + throw std::runtime_error("Can't close stderr"); + if (dup(filedes[1]) == -1) + throw std::runtime_error("Replace stdout w/ pipe input"); + } void teardown(){} }; @@ -36,6 +45,7 @@ BOOST_FIXTURE_TEST_CASE(validate, AuthFixture) { BOOST_CHECK(Auth::validate("t5MMkLQXzYkdw", "abc")); + BOOST_CHECK(!Auth::validate("", "")); BOOST_CHECK(!Auth::validate("abc", "abc")); BOOST_CHECK(!Auth::validate("t5MNkLQXzYkdw", "abc")); } |