コード例 #1
0
ファイル: TestModel.py プロジェクト: maeddlae/keepit
 def testAddEntry(self):
     '''Checks only if the right method of db is called'''
     entry = ModelEntry(self.log, "new entry")
     self.model.db.addEntry = MagicMock()
     self.model.addEntry(entry)
     self.model.db.addEntry.assert_called_with(entry)
コード例 #2
0
 def testUpdateEntryIfNotExists(self):
     '''Trys to update an entries tags and description'''
     n = ModelEntry(self.log, "bikes")
     self.db.updateEntry(n)
     rows = self.getAllRows(self.dbPath)
     self.assertFalse(self.containsEntry(rows, n))
コード例 #3
0
 def testAddExisting(self):
     '''Trys to add an existing entry'''
     n = ModelEntry(self.log, "buildings")
     self.db.addEntry(n)
     rows = self.getAllRows(self.dbPath)
     self.assertFalse(self.containsEntry(rows, n), "Entry has been added")
コード例 #4
0
 def testHasEntryNegative(self):
     '''Questioned entry does not exist'''
     n = ModelEntry(self.log, "bikes")
     self.assertFalse(self.db.hasEntry(n))
コード例 #5
0
ファイル: TestController.py プロジェクト: maeddlae/keepit
 def testDeleteEntryAction(self):
     self.ctr.model.currentEntry = ModelEntry(self.log, "e1")
     self.ctr.deleteEntryAction()
     self.ctr.model.removeEntry.assert_called_once_with(self.ctr.model.currentEntry)
     self.ctr.view.removeEntry.assert_called_once_with(self.ctr.model.currentEntry)
コード例 #6
0
    def setUp(self):
        self.log = Log("testlog.txt")
        self.log.add = MagicMock()

        self.entry = ModelEntry(self.log, "testentry")