Example #1
0
    def test_delete_item(self):
        j = JSon(config.backend_json['filename'])

        t = Task('new task')
        t.id = 3
        t.category_id=1

        key = 'Task.3'

        j.delete_item(t)
        j.commit()

        self.assertNotIn(key, j.data.keys())
Example #2
0
    def test_encoder(self):
        p = Project('test')
        p.id = 1
        c = Category('test')
        c.id = 2
        c.project_id = p.id
        t = Task('test')
        t.id = 3
        t.category_id = c.id

        self.assertIsNotNone(json.dumps(p, cls=ModelEncoder))
        self.assertIsNotNone(json.dumps(c, cls=ModelEncoder))
        self.assertIsNotNone(json.dumps(t, cls=ModelEncoder))