def extractSubStore(self, localpart, domain, destinationPath): siteStore = self.parent.getStore() la = siteStore.findFirst( userbase.LoginMethod, attributes.AND(userbase.LoginMethod.localpart == localpart, userbase.LoginMethod.domain == domain)).account userbase.extractUserStore(la, destinationPath)
def testExtraction(self): userbase.extractUserStore(self.account, self.destdir) self.assertEquals(self.ls.accountByAddress(u'testuser', u'localhost'), None) self.failIf( list(self.store.query(SubStore, SubStore.storepath == self.origdir))) self.origdir.restat(False) self.failIf(self.origdir.exists())
def test_noTimedEventsExtraction(self): """ Ensure that user store extraction works correctly if no timed events are present. """ userbase.extractUserStore(self.account, self.destdir) self.assertEqual( self.ls.accountByAddress(self.localpart, self.domain), None) self.assertFalse(list(self.store.query(SubStore, SubStore.storepath == self.origdir))) self.origdir.restat(False) self.assertFalse(self.origdir.exists()) self.assertFalse(list(self.store.query(_SubSchedulerParentHook)))