From e238261578c19d3736727f599852e8868d60688d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 9 Sep 2020 21:18:29 +0100 Subject: Test EntCache basics for User and Group --- netfs/unittests/testLib.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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) +{ + 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) +{ + 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); +} -- cgit v1.2.3