diff options
Diffstat (limited to 'gentoobrowse-api/unittests/testUsers.cpp')
-rw-r--r-- | gentoobrowse-api/unittests/testUsers.cpp | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/gentoobrowse-api/unittests/testUsers.cpp b/gentoobrowse-api/unittests/testUsers.cpp index e3fb3c9..51ddb08 100644 --- a/gentoobrowse-api/unittests/testUsers.cpp +++ b/gentoobrowse-api/unittests/testUsers.cpp @@ -4,11 +4,11 @@ #include "mockDefs.h" #include <mockMailServer.h> -BOOST_GLOBAL_FIXTURE( Service ); +BOOST_GLOBAL_FIXTURE(Service); BOOST_FIXTURE_TEST_SUITE(tp, TestClient) -BOOST_AUTO_TEST_CASE( authenticateGood ) +BOOST_AUTO_TEST_CASE(authenticateGood) { auto user = u->authenticate("randomdan", "p@55w0rd"); BOOST_REQUIRE_EQUAL(1, user->userid); @@ -17,22 +17,22 @@ BOOST_AUTO_TEST_CASE( authenticateGood ) BOOST_REQUIRE_EQUAL("dan@randomdan.homeip.net", user->useremail); } -BOOST_AUTO_TEST_CASE( authenticateBad ) +BOOST_AUTO_TEST_CASE(authenticateBad) { BOOST_REQUIRE_THROW(u->authenticate("bad", "login"), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( authenticateUnverified ) +BOOST_AUTO_TEST_CASE(authenticateUnverified) { BOOST_REQUIRE_THROW(u->authenticate("unverified", "p@55w0rd"), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( authenticateVerifyBad ) +BOOST_AUTO_TEST_CASE(authenticateVerifyBad) { BOOST_REQUIRE_THROW(u->verify("unverified", "c2075a2e-8a45-11e6-bb50-c86000a60e12"), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( authenticateVerify ) +BOOST_AUTO_TEST_CASE(authenticateVerify) { auto verified = u->verify("unverified", "a24eb4fa-8a42-11e6-a04e-c86000a60e12"); BOOST_REQUIRE(verified); @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE( authenticateVerify ) BOOST_REQUIRE_THROW(u->verify("unverified", "a24eb4fa-8a42-11e6-a04e-c86000a60e12"), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( create ) +BOOST_AUTO_TEST_CASE(create) { auto ms1 = IceTray::Cube::get<IceTray::Mail::MailServer>(); BOOST_REQUIRE(ms1); @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE( create ) BOOST_REQUIRE_EQUAL(36, user->verifyguid.length()); } -BOOST_AUTO_TEST_CASE( get ) +BOOST_AUTO_TEST_CASE(get) { auto user = u->get(1); BOOST_REQUIRE(user); @@ -74,13 +74,13 @@ BOOST_AUTO_TEST_CASE( get ) BOOST_REQUIRE(!user->lastmailshot); } -BOOST_AUTO_TEST_CASE( getNotVerified ) +BOOST_AUTO_TEST_CASE(getNotVerified) { // Is not verified, doesn't exist BOOST_REQUIRE_THROW(u->get(4), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( getNew ) +BOOST_AUTO_TEST_CASE(getNew) { auto user = u->getNew("testuser", "testpass"); BOOST_REQUIRE(user); @@ -93,13 +93,13 @@ BOOST_AUTO_TEST_CASE( getNew ) BOOST_REQUIRE(!user->lastmailshot); } -BOOST_AUTO_TEST_CASE( getNewVerified ) +BOOST_AUTO_TEST_CASE(getNewVerified) { // Is verified, not new BOOST_REQUIRE_THROW(u->getNew("randomdan", "p@55w0rd"), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( createAgain ) +BOOST_AUTO_TEST_CASE(createAgain) { /* * Should (unverified): @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE( createAgain ) BOOST_REQUIRE_EQUAL(36, user->verifyguid.length()); } -BOOST_AUTO_TEST_CASE( prune ) +BOOST_AUTO_TEST_CASE(prune) { BOOST_REQUIRE(u->get(1)); // Verified BOOST_REQUIRE(u->getNew("dontverify", "p@55w0rd")); // Old, not verified @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE( prune ) BOOST_REQUIRE(u->getNew("testuser", "testpass")); // Not delete; New, not verified } -BOOST_AUTO_TEST_CASE( verify ) +BOOST_AUTO_TEST_CASE(verify) { auto user = u->getNew("testuser", "testpass"); BOOST_REQUIRE(user); @@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE( verify ) BOOST_REQUIRE(u->get(4)); } -BOOST_AUTO_TEST_CASE( sendmailshot ) +BOOST_AUTO_TEST_CASE(sendmailshot) { auto user = u->get(4); BOOST_REQUIRE(user); @@ -154,12 +154,12 @@ BOOST_AUTO_TEST_CASE( sendmailshot ) BOOST_REQUIRE_GE(user->lastmailshot->length(), 19); } -BOOST_AUTO_TEST_CASE( getMissing ) +BOOST_AUTO_TEST_CASE(getMissing) { BOOST_REQUIRE_THROW(u->get(20), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( find ) +BOOST_AUTO_TEST_CASE(find) { auto user = u->find("testuser"); BOOST_REQUIRE_EQUAL(4, user->userid); @@ -168,12 +168,12 @@ BOOST_AUTO_TEST_CASE( find ) BOOST_REQUIRE_EQUAL("test@user.com", user->useremail); } -BOOST_AUTO_TEST_CASE( findMissing ) +BOOST_AUTO_TEST_CASE(findMissing) { BOOST_REQUIRE_THROW(u->find("nobody"), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( deleteCheck ) +BOOST_AUTO_TEST_CASE(deleteCheck) { u->get(4); u->remove(3, "wrongpass"); @@ -182,22 +182,21 @@ BOOST_AUTO_TEST_CASE( deleteCheck ) BOOST_REQUIRE_THROW(u->get(4), Slicer::NoRowsReturned); } -BOOST_AUTO_TEST_CASE( track ) +BOOST_AUTO_TEST_CASE(track) { u->track(1, 44473); } -BOOST_AUTO_TEST_CASE( tracked ) +BOOST_AUTO_TEST_CASE(tracked) { auto ids = u->tracked(1); BOOST_REQUIRE_EQUAL(4, ids.size()); BOOST_REQUIRE_EQUAL(44473, ids.front()); } -BOOST_AUTO_TEST_CASE( untrack ) +BOOST_AUTO_TEST_CASE(untrack) { u->untrack(1, 44473); } BOOST_AUTO_TEST_SUITE_END() - |