def testMergeWith(self): ## Create an authenticated session auth_session = AuthenticatedSession(self.cfg, self.email, passwd=self.passwd) ## Merging a session with itself should fail self.assertRaises(SessionError, auth_session.mergeWith, auth_session) ## Create an anonymous session self.cfg._anonymous_session = "yes" key = "anonymous_01" self._makeFakeSession(key) anno_session = AnonymousSession(self.cfg, key=key) jobs = anno_session.getAllJobs() datas = anno_session.getAllData() ## Merge sessions auth_session.mergeWith(anno_session) newJobs = auth_session.getAllJobs() newDatas = auth_session.getAllData() self.assertEqual(jobs, newJobs) self.assertEqual(datas, newDatas)