summaryrefslogtreecommitdiffhomepage
path: root/tests/test-auth.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-auth.cpp')
-rw-r--r--tests/test-auth.cpp12
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"));
}