Exemplo n.º 1
0
 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)
Exemplo n.º 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))
Exemplo 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")
Exemplo n.º 4
0
 def testHasEntryNegative(self):
     '''Questioned entry does not exist'''
     n = ModelEntry(self.log, "bikes")
     self.assertFalse(self.db.hasEntry(n))
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
    def setUp(self):
        self.log = Log("testlog.txt")
        self.log.add = MagicMock()

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