Beispiel #1
0
 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)
Beispiel #2
0
 def testLoad(self):
     import time
     store = StoreMock()
     store.setValue("Title", "MyTitle")
     store.setValue("Content", "MyContent")
     updated = time.gmtime(time.time())
     store.setValue("Updated", updated)
     store.setValue("Url", "MyUrl")
     store.setValue("Id", "MyId")
     store.setValue("Author", "MyAuthor")
     store.setValue("Read", True)
     store.setValue("Important", True)
     entry = Entry()
     entry.load(store)
     self.assertEqual(entry.title, "MyTitle")
     self.assertEqual(entry.author, "MyAuthor")
     self.assertEqual(entry.url, "MyUrl")
     self.assertEqual(entry.identity, "MyId")
     self.assertEqual(entry.updated, updated)
     self.assertEqual(entry.content, "MyContent")
     self.assertEqual(entry.read, True)
     self.assertEqual(entry.important, True)
Beispiel #3
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)