diff --git a/src/um/test/UserPoolTest.cc b/src/um/test/UserPoolTest.cc index c61825876a..65cd82c7b1 100755 --- a/src/um/test/UserPoolTest.cc +++ b/src/um/test/UserPoolTest.cc @@ -43,6 +43,7 @@ class UserPoolTest : public CppUnit::TestFixture CPPUNIT_TEST (get_from_db); CPPUNIT_TEST (drop_and_get); CPPUNIT_TEST (update); + CPPUNIT_TEST (dump); CPPUNIT_TEST_SUITE_END (); private: @@ -302,11 +303,54 @@ public: CPPUNIT_ASSERT( user->isEnabled() == false ); //Now force access to DB - + pool->clean(); user = pool->get(oid_1,false); CPPUNIT_ASSERT( user->isEnabled() == false ); }; + + void dump() + { + string xml_result = + "0one_user_test" + "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" + "True1a" + "pTrue" + "2a namepass" + "True3a_name" + "passwordTrue" + "4another namesecret" + "True5user" + "1234True" + ""; + + + string names[] = {"a", "a name", "a_name", "another name", "user"}; + string pass[] = {"p", "pass", "password", "secret", "1234"}; + + int oid; + + for(int i=0; i<5; i++) + { + pool->allocate(&oid, names[i], pass[i], true); + } + + ostringstream oss; + pool->dump(oss, ""); + + CPPUNIT_ASSERT( oss.str() == xml_result ); + + // Allocate and delete a new user + pool->allocate(&oid, "new name", "new pass", true); + user = pool->get(oid, true); + pool->drop(user); + user->unlock(); + + ostringstream new_oss; + pool->dump(new_oss, ""); + + CPPUNIT_ASSERT( new_oss.str() == xml_result ); + } }; /* ************************************************************************* */