added test for the deletePlaylist() method

This commit is contained in:
fgerlits 2004-10-04 14:52:48 +00:00
parent dff6f1aafd
commit 8e3a6e1584
2 changed files with 43 additions and 6 deletions

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -117,3 +117,30 @@ TestStorageClientTest :: firstTest(void)
CPPUNIT_ASSERT(playlist->getId()->getId() == id1->getId()); CPPUNIT_ASSERT(playlist->getId()->getId() == id1->getId());
} }
/*------------------------------------------------------------------------------
* Testing the deletePlaylist method
*----------------------------------------------------------------------------*/
void
TestStorageClientTest :: deletePlaylistTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<UniqueId>::Ref id1(new UniqueId(1));
Ptr<UniqueId>::Ref id2(new UniqueId(2));
try {
tsc->deletePlaylist(id2);
CPPUNIT_FAIL("allowed to delete non-existent playlist");
} catch (std::invalid_argument &e) {
}
try {
tsc->deletePlaylist(id1);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("cannot delete existing playlist");
}
try {
tsc->deletePlaylist(id1);
CPPUNIT_FAIL("allowed to delete non-existent playlist");
} catch (std::invalid_argument &e) {
}
}

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -57,14 +57,15 @@ namespace Storage {
/** /**
* Unit test for the UploadPlaylistMetohd class. * Unit test for the UploadPlaylistMetohd class.
* *
* @author $Author: maroy $ * @author $Author: fgerlits $
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
* @see TestStorageClient * @see TestStorageClient
*/ */
class TestStorageClientTest : public CPPUNIT_NS::TestFixture class TestStorageClientTest : public CPPUNIT_NS::TestFixture
{ {
CPPUNIT_TEST_SUITE(TestStorageClientTest); CPPUNIT_TEST_SUITE(TestStorageClientTest);
CPPUNIT_TEST(firstTest); CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(deletePlaylistTest);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
@ -83,6 +84,15 @@ class TestStorageClientTest : public CPPUNIT_NS::TestFixture
void void
firstTest(void) throw (CPPUNIT_NS::Exception); firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* Testing deletePlaylist().
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
deletePlaylistTest(void)
throw (CPPUNIT_NS::Exception);
public: public:
/** /**