[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [KSecretService] 3f4b4d5: Update for unit tests. Unlock test still
From:       Valentin Rusu <kde () rusu ! info>
Date:       2010-11-09 19:14:34
Message-ID: 20101109191434.DA61BA610D () git ! kde ! org
[Download RAW message or body]

commit 3f4b4d566337874f491b6347dd9dc0a9501e8c7f
branch master
Author: Valentin Rusu <kde@rusu.info>
Date:   Tue Nov 2 23:00:08 2010 +0000

    Update for unit tests. Unlock test still not working though.
    
    svn path=/trunk/playground/base/ksecretservice/; revision=1192410

diff --git a/backend/ksecret/ksecretjobs.cpp b/backend/ksecret/ksecretjobs.cpp
index 9790f7b..2a3cf0f 100644
--- a/backend/ksecret/ksecretjobs.cpp
+++ b/backend/ksecret/ksecretjobs.cpp
@@ -184,7 +184,7 @@ void KSecretUnlockCollectionJob::start()
 void KSecretUnlockCollectionJob::createAskPasswordJob()
 {
     AbstractUiManager *uiManager = BackendMaster::instance()->uiManager();
-    // start a job for getting a new password for the collection from the user.
+    // start a job for getting the password for the collection from the user.
     AbstractAskPasswordJob *subJob = uiManager->createAskPasswordJob(collection()->label().value(),
                                      !m_firstTry);
     connect(subJob, SIGNAL(result(QueuedJob*)), SLOT(askPasswordJobResult(QueuedJob*)));
diff --git a/backend/tests/ksecretuitest.cpp b/backend/tests/ksecretuitest.cpp
index 6e129dc..768a69d 100644
--- a/backend/tests/ksecretuitest.cpp
+++ b/backend/tests/ksecretuitest.cpp
@@ -55,7 +55,7 @@ void KSecretUiTest::initTestCase()
 void KSecretUiTest::testCreateCollectionAsync()
 {
     CollectionCreateInfo createCollectionInfo("test", Peer( QCoreApplication::applicationPid() ));
-    createCollectionInfo.m_locked = false;
+    createCollectionInfo.m_locked = true;
     CreateCollectionJob *createColl = m_manager->createCreateCollectionJob(createCollectionInfo);
     QSignalSpy managerSpy(m_manager, SIGNAL(collectionCreated(BackendCollection*)));
     QSignalSpy masterSpy(BackendMaster::instance(), SIGNAL(collectionCreated(BackendCollection*)));
@@ -84,6 +84,7 @@ void KSecretUiTest::testCreateCollectionAsync()
     QCOMPARE(master->collections().first()->label().value(), QLatin1String("test"));
 
     // TODO: check collection attributes (eg. timestamps)
+    QVERIFY(createColl->collection()->isLocked());
 
     // check that the collection has been written to disk
     QStringList entries = QDir(KGlobal::dirs()->saveLocation("ksecret")).entryList(
@@ -97,6 +98,7 @@ void KSecretUiTest::testCreateCollectionAsync()
 
 void KSecretUiTest::testUnlockCollectionAsync()
 {
+    QVERIFY( m_collection->isLocked() ); // the test above must create the collection in locked state
     CollectionUnlockInfo unlockInfo = CollectionUnlockInfo( Peer( QCoreApplication::applicationPid() ));
     UnlockCollectionJob *unlockColl = m_collection->createUnlockJob(unlockInfo);
     BackendMaster *master = BackendMaster::instance();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic