def setUp(self): import time self.feed = Feed() entry = Mock("Entry") entry.title = "Title1" entry.author = "Author1" entry.read = False entry.important = False entry.updated = time.gmtime(time.time()) self.feed.entries.append(entry) entry = Mock("Entry") entry.title = "Title2" entry.author = "Author2" entry.read = True entry.important = True entry.updated = time.gmtime(time.time()) self.feed.entries.append(entry) self.entryModel = EntryModel(self.feed) self.modeltest = ModelTest(self.entryModel, self.entryModel)
def testAddFeed(self): model = self.feedModel feed = Mock("Feed") feed.title = "Title3" feed.author = "Author3" feed.updated = time.gmtime(time.time()) feed.unread = 2 feed.entries = [1, 4] self.assertEqual(model.rowCount(), 2) model.addFeed(feed) self.assertEqual(model.rowCount(), 3)
def setUp(self): self.feedMgr = FeedManager() feed = Mock("Feed") feed.title = "Title1" feed.author = "Author1" feed.url = "Url1" feed.updated = time.gmtime(time.time()) feed.unread = 1 feed.entries = [Entry(), Entry(), Entry()] self.feedMgr.feeds.append(feed) feed = Mock("Feed") feed.title = "Title2" feed.author = "Author2" feed.url = "Url2" feed.updated = time.gmtime(time.time()) feed.unread = 0 feed.entries = [Entry(), Entry()] self.feedMgr.feeds.append(feed) self.feedModel = FeedModel(self.feedMgr) self.modeltest = ModelTest(self.feedModel, self.feedModel) self.entryModel = MockEntryModel()