def test_read(self): # TODO: add desired output json t = db.read(self.dummy_id) self.assertIsInstance(t, str) dct = json.loads(t) self.assertTrue(dct['__task__']) self.assertIsInstance(dct['data'], dict)
def test_delete(self): db.read(self.delete_id) db.delete(self.delete_id) with self.assertRaises(TaskNotFoundError): db.read(self.delete_id)
def test_update(self): new_dct = json.loads(db.read(self.modify_id)) new_dct['desc'] = 'modified' db.update(json.dumps(new_dct)) data = json.loads(db.read(self.modify_id)) self.assertEqual(data['desc'], "modified")
def test_read_invalid_tid(self): invalid_tid = self.dummy_id + 1000 with self.assertRaises(TaskNotFoundError): t = db.read(invalid_tid)