diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-09-09 21:18:29 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-09-09 21:18:29 +0100 |
commit | e238261578c19d3736727f599852e8868d60688d (patch) | |
tree | bdc053fa04c1db4524d6a1412cff39e2eb5230a0 | |
parent | Fix group membership loading (diff) | |
download | netfs-e238261578c19d3736727f599852e8868d60688d.tar.bz2 netfs-e238261578c19d3736727f599852e8868d60688d.tar.xz netfs-e238261578c19d3736727f599852e8868d60688d.zip |
Test EntCache basics for User and Group
-rw-r--r-- | netfs/unittests/testLib.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/netfs/unittests/testLib.cpp b/netfs/unittests/testLib.cpp index ba3ef44..2985c93 100644 --- a/netfs/unittests/testLib.cpp +++ b/netfs/unittests/testLib.cpp @@ -65,3 +65,28 @@ BOOST_AUTO_TEST_CASE(group_membership) BOOST_CHECK(!g.hasMember(3)); BOOST_CHECK(!g.hasMember(6)); } + +// These tests make some assumptions about local system users +BOOST_FIXTURE_TEST_CASE(usercache, EntCache<User>) +{ + auto root = getEntry(0); + BOOST_REQUIRE(root); + BOOST_CHECK_EQUAL(root->id, 0); + BOOST_CHECK_EQUAL(root->name, "root"); + BOOST_CHECK_EQUAL(root->group, 0); + + auto rootByName = getEntry(root->name); + BOOST_REQUIRE_EQUAL(root, rootByName); +} + +BOOST_FIXTURE_TEST_CASE(groupcache, EntCache<Group>) +{ + auto root = getEntry(0); + BOOST_REQUIRE(root); + BOOST_CHECK_EQUAL(root->id, 0); + BOOST_CHECK_EQUAL(root->name, "root"); + BOOST_CHECK(root->hasMember(0)); + + auto rootByName = getEntry(root->name); + BOOST_REQUIRE_EQUAL(root, rootByName); +} |