예제 #1
0
 def testLoad(self):
     import time
     from base64 import b64encode
     updated = time.gmtime(time.time())
     store = StoreMock()
     store.beginGroup("Feed_%s" % b64encode("T1"))
     store.setValue("Title", "T1")
     store.setValue("Updated", updated)
     store.setValue("Author", "Author1")
     store.setValue("Url", "Url1")
     store.endGroup()
     store.beginGroup("Feed_%s" % b64encode("T2"))
     store.setValue("Title", "T2")
     store.setValue("Updated", updated)
     store.setValue("Author", "Author2")
     store.setValue("Url", "Url2")
     store.endGroup()
     self.feedManager.load(store)
     self.assertEqual(len(self.feedManager.feeds), 2)
예제 #2
0
파일: test_feed.py 프로젝트: apaku/slimfeed
 def testLoad(self):
     import time
     from base64 import b64encode
     updated = time.gmtime(time.time())
     store = StoreMock()
     store.setValue("Title", "TestTitle")
     store.setValue("Url", "TestUrl")
     store.setValue("Homepage", "Homepage")
     store.setValue("Author", "TestAuthor")
     store.setValue("Updated", updated)
     store.setValue("DeletedEntryIds", ["789","101112"])
     store.beginGroup("Entry_%s" % b64encode("Id1"))
     store.setValue("Title", "T1")
     store.setValue("Updated", updated)
     store.setValue("Author", "Author1")
     store.setValue("Url", "Url1")
     store.setValue("Id", "Id1")
     store.setValue("Content", "Content1")
     store.setValue("Read", True)
     store.endGroup()
     store.beginGroup("Entry_%s" % b64encode("Id2"))
     store.setValue("Title", "T2")
     store.setValue("Updated", updated)
     store.setValue("Author", "Author2")
     store.setValue("Url", "Url2")
     store.setValue("Id", "Id2")
     store.setValue("Content", "Content2")
     store.endGroup()
     self.savefeed.load(store)
     self.assertEqual(self.savefeed.title, "TestTitle")
     self.assertEqual(self.savefeed.updated, updated)
     self.assertEqual(self.savefeed.url, "TestUrl")
     self.assertEqual(self.savefeed.homepage, "Homepage")
     self.assertEqual(self.savefeed.author, "TestAuthor")
     self.assertEqual(self.savefeed.unread, 1)
     self.assertEqual(len(self.savefeed.deleted_entry_ids), 2)
     self.assertEqual(self.savefeed.deleted_entry_ids, ["789","101112"])
     self.assertEqual(len(self.savefeed.entries), 2)