diff options
Diffstat (limited to 'gentoobrowse-api/unittests/testUsers.cpp')
-rw-r--r-- | gentoobrowse-api/unittests/testUsers.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gentoobrowse-api/unittests/testUsers.cpp b/gentoobrowse-api/unittests/testUsers.cpp index 93c8fdd..e4c1ac4 100644 --- a/gentoobrowse-api/unittests/testUsers.cpp +++ b/gentoobrowse-api/unittests/testUsers.cpp @@ -41,5 +41,64 @@ BOOST_AUTO_TEST_CASE( authenticateVerify ) BOOST_REQUIRE_THROW(u->verify("unverified", "a24eb4fa-8a42-11e6-a04e-c86000a60e12"), Slicer::NoRowsReturned); } +BOOST_AUTO_TEST_CASE( create ) +{ + auto user = u->create("testuser", "testpass", "Test User", "test@user.com"); + BOOST_REQUIRE_EQUAL(3, user->userid); + BOOST_REQUIRE_EQUAL("testuser", user->username); + BOOST_REQUIRE_EQUAL("Test User", user->userrealname); + BOOST_REQUIRE_EQUAL("test@user.com", user->useremail); + BOOST_REQUIRE_EQUAL(36, user->verifyguid.length()); + auto verified = u->verify(user->username, user->verifyguid); + BOOST_REQUIRE(verified); +} + +BOOST_AUTO_TEST_CASE( get ) +{ + auto user = u->get(3); + BOOST_REQUIRE_EQUAL(3, user->userid); + BOOST_REQUIRE_EQUAL("testuser", user->username); + BOOST_REQUIRE_EQUAL("Test User", user->userrealname); + BOOST_REQUIRE_EQUAL("test@user.com", user->useremail); +} + +BOOST_AUTO_TEST_CASE( getMissing ) +{ + BOOST_REQUIRE_THROW(u->get(20), Slicer::NoRowsReturned); +} + +BOOST_AUTO_TEST_CASE( find ) +{ + auto user = u->find("testuser"); + BOOST_REQUIRE_EQUAL(3, user->userid); + BOOST_REQUIRE_EQUAL("testuser", user->username); + BOOST_REQUIRE_EQUAL("Test User", user->userrealname); + BOOST_REQUIRE_EQUAL("test@user.com", user->useremail); +} + +BOOST_AUTO_TEST_CASE( findMissing ) +{ + BOOST_REQUIRE_THROW(u->find("nobody"), Slicer::NoRowsReturned); +} + +BOOST_AUTO_TEST_CASE( deleteCheck ) +{ + u->get(3); + u->remove(3, "wrongpass"); + u->get(3); + u->remove(3, "testpass"); + BOOST_REQUIRE_THROW(u->get(3), Slicer::NoRowsReturned); +} + +BOOST_AUTO_TEST_CASE( track ) +{ + u->track(1, 44473); +} + +BOOST_AUTO_TEST_CASE( untrack ) +{ + u->untrack(1, 44473); +} + BOOST_AUTO_TEST_SUITE_END() |