summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-03-04 16:46:53 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2018-03-04 16:46:53 +0000
commitce9a0047bec77fffe093e6ebb82dee2f28961c02 (patch)
treea7d505a756feae783a5a267aa688c081f6f8ddb6
parentUse Boost's GE tests, not > (the change to >= is deliberate) (diff)
downloadgentoobrowse-api-ce9a0047bec77fffe093e6ebb82dee2f28961c02.tar.bz2
gentoobrowse-api-ce9a0047bec77fffe093e6ebb82dee2f28961c02.tar.xz
gentoobrowse-api-ce9a0047bec77fffe093e6ebb82dee2f28961c02.zip
Add a test user we never verify
-rw-r--r--gentoobrowse-api/unittests/data.sql2
-rw-r--r--gentoobrowse-api/unittests/fixtures/users.dat1
-rw-r--r--gentoobrowse-api/unittests/testUsers.cpp28
3 files changed, 16 insertions, 15 deletions
diff --git a/gentoobrowse-api/unittests/data.sql b/gentoobrowse-api/unittests/data.sql
index 90d4434..1ae82d0 100644
--- a/gentoobrowse-api/unittests/data.sql
+++ b/gentoobrowse-api/unittests/data.sql
@@ -28,5 +28,5 @@ COPY gentoobrowse.user_packages (userid, packageid, trackedsince) FROM '$SCRIPTD
COPY gentoobrowse.changelog (changeid, repoid, commitid, committime, authorname, authoremail, summary, body, files) FROM '$SCRIPTDIR/fixtures/changelog.dat';
ALTER SEQUENCE users_userid_seq
- RESTART WITH 3;
+ RESTART WITH 4;
diff --git a/gentoobrowse-api/unittests/fixtures/users.dat b/gentoobrowse-api/unittests/fixtures/users.dat
index cbc63fb..ee40eb3 100644
--- a/gentoobrowse-api/unittests/fixtures/users.dat
+++ b/gentoobrowse-api/unittests/fixtures/users.dat
@@ -1,2 +1,3 @@
1 randomdan Dan Goodliffe p@55w0rd dan@randomdan.homeip.net \N \N 2015-10-01T12:13:14
2 unverified Dan Goodliffe p@55w0rd something@randomdan.homeip.net a24eb4fa-8a42-11e6-a04e-c86000a60e12 \N 2015-10-01T12:13:14
+3 dontverify Dan Goodliffe p@55w0rd dontverify@test.com fb6e8b52-1157-4011-ba33-198d181192b8 \N 2015-10-01T12:13:14
diff --git a/gentoobrowse-api/unittests/testUsers.cpp b/gentoobrowse-api/unittests/testUsers.cpp
index 7eb0ba3..c3380ed 100644
--- a/gentoobrowse-api/unittests/testUsers.cpp
+++ b/gentoobrowse-api/unittests/testUsers.cpp
@@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE( create )
BOOST_REQUIRE_EQUAL("Gentoo Browse: Welcome", ms->getSentEmails().front()->subject);
BOOST_REQUIRE_EQUAL("test@user.com", ms->getSentEmails().front()->to.address);
BOOST_REQUIRE_EQUAL("Test User", ms->getSentEmails().front()->to.name);
- BOOST_REQUIRE_EQUAL(3, user->userid);
+ BOOST_REQUIRE_EQUAL(4, user->userid);
BOOST_REQUIRE_EQUAL("testuser", user->username);
BOOST_REQUIRE_EQUAL("Test User", user->userrealname);
BOOST_REQUIRE_EQUAL("test@user.com", user->useremail);
@@ -74,14 +74,14 @@ BOOST_AUTO_TEST_CASE( get )
BOOST_AUTO_TEST_CASE( getNotVerified )
{
// Is not verified, doesn't exist
- BOOST_REQUIRE_THROW(u->get(3), Slicer::NoRowsReturned);
+ BOOST_REQUIRE_THROW(u->get(4), Slicer::NoRowsReturned);
}
BOOST_AUTO_TEST_CASE( getNew )
{
auto user = u->getNew("testuser", "testpass");
BOOST_REQUIRE(user);
- BOOST_REQUIRE_EQUAL(3, user->userid);
+ BOOST_REQUIRE_EQUAL(4, user->userid);
BOOST_REQUIRE_EQUAL("testuser", user->username);
BOOST_REQUIRE_EQUAL("Test User", user->userrealname);
BOOST_REQUIRE_EQUAL("test@user.com", user->useremail);
@@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE( createAgain )
BOOST_REQUIRE_EQUAL(2, ms->getSentEmails().size());
BOOST_REQUIRE_EQUAL("Gentoo Browse: Welcome", ms->getSentEmails()[1]->subject);
BOOST_REQUIRE_EQUAL("test@user.com", ms->getSentEmails()[1]->to.address);
- BOOST_REQUIRE_EQUAL(3, user->userid);
+ BOOST_REQUIRE_EQUAL(4, user->userid);
BOOST_REQUIRE_EQUAL(36, user->verifyguid.length());
}
@@ -120,18 +120,18 @@ BOOST_AUTO_TEST_CASE( verify )
auto verified = u->verify(user->username, user->verifyguid);
BOOST_REQUIRE(verified);
BOOST_REQUIRE_THROW(u->getNew("testuser", "testpass"), Slicer::NoRowsReturned);
- BOOST_REQUIRE(u->get(3));
+ BOOST_REQUIRE(u->get(4));
}
BOOST_AUTO_TEST_CASE( sendmailshot )
{
- auto user = u->get(3);
+ auto user = u->get(4);
BOOST_REQUIRE(user);
BOOST_REQUIRE(!user->lastmailshot);
- u->mailshotsent(3);
- user = u->get(3);
+ u->mailshotsent(4);
+ user = u->get(4);
BOOST_REQUIRE(user);
- BOOST_REQUIRE_EQUAL(3, user->userid);
+ BOOST_REQUIRE_EQUAL(4, user->userid);
BOOST_REQUIRE_EQUAL("testuser", user->username);
BOOST_REQUIRE_EQUAL("Test User", user->userrealname);
BOOST_REQUIRE_EQUAL("test@user.com", user->useremail);
@@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE( getMissing )
BOOST_AUTO_TEST_CASE( find )
{
auto user = u->find("testuser");
- BOOST_REQUIRE_EQUAL(3, user->userid);
+ BOOST_REQUIRE_EQUAL(4, user->userid);
BOOST_REQUIRE_EQUAL("testuser", user->username);
BOOST_REQUIRE_EQUAL("Test User", user->userrealname);
BOOST_REQUIRE_EQUAL("test@user.com", user->useremail);
@@ -161,11 +161,11 @@ BOOST_AUTO_TEST_CASE( findMissing )
BOOST_AUTO_TEST_CASE( deleteCheck )
{
- u->get(3);
+ u->get(4);
u->remove(3, "wrongpass");
- u->get(3);
- u->remove(3, "testpass");
- BOOST_REQUIRE_THROW(u->get(3), Slicer::NoRowsReturned);
+ u->get(4);
+ u->remove(4, "testpass");
+ BOOST_REQUIRE_THROW(u->get(4), Slicer::NoRowsReturned);
}
BOOST_AUTO_TEST_CASE( track )