示例#1
0
 def testSave(self):
     store = StoreMock()
     feed = Feed()
     feed.title = "T1"
     self.feedManager.feeds.append(feed)
     feed = Feed()
     feed.title = "T2"
     self.feedManager.feeds.append(feed)
     feed = Feed()
     self.feedManager.feeds.append(feed)
     self.feedManager.save(store)
     self.assertEqual(len(store.childGroups()), 3)
示例#2
0
 def testSave(self):
     store = StoreMock()
     self.saveentry.save(store)
     self.assertEqual(store.value("Title"), self.saveentry.title)
     self.assertEqual(store.value("Url"), self.saveentry.url)
     self.assertEqual(store.value("Author"), self.saveentry.author)
     self.assertEqual(store.value("Content"), self.saveentry.content)
     self.assertEqual(store.value("Updated"), self.saveentry.updated)
     self.assertEqual(store.value("Id"), self.saveentry.identity)
     self.assertEqual(store.value("Read"), self.saveentry.read)
     self.assertEqual(store.value("Important"), self.saveentry.important)
示例#3
0
 def testSave(self):
     entry = Entry()
     store = StoreMock()
     self.savefeed.entries.append(entry)
     self.savefeed.save(store)
     self.assertEqual(len(store.childGroups()), 1)
     self.assertEqual(self.savefeed.title, store.value("Title"))
     self.assertEqual(self.savefeed.author, store.value("Author"))
     self.assertEqual(self.savefeed.url, store.value("Url"))
     self.assertEqual(self.savefeed.updated, store.value("Updated"))
     self.assertEqual(self.savefeed.deleted_entry_ids, store.value("DeletedEntryIds", []))
示例#4
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)
示例#5
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)
示例#6
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)