def test_task_delete(self):
        created = db_api.task_create(TASKS[0]['workbook_name'],
                                     TASKS[0]['execution_id'], TASKS[0])
        self.assertIsInstance(created, dict)

        fetched = db_api.task_get(TASKS[0]['workbook_name'],
                                  TASKS[0]['execution_id'], created['id'])
        self.assertIsInstance(fetched, dict)
        self.assertDictEqual(created, fetched)

        db_api.task_delete(TASKS[0]['workbook_name'], TASKS[0]['execution_id'],
                           created['id'])
        self.assertIsNone(
            db_api.task_get(TASKS[0]['workbook_name'],
                            TASKS[0]['execution_id'], created['id']))
    def test_task_create_and_get(self):
        created = db_api.task_create(TASKS[0]['execution_id'],
                                     TASKS[0])
        self.assertIsInstance(created, dict)

        fetched = db_api.task_get(created['id'])
        self.assertIsInstance(fetched, dict)
        self.assertDictEqual(created, fetched)
    def test_task_delete(self):
        created = db_api.task_create(TASKS[0]['workbook_name'],
                                     TASKS[0]['execution_id'],
                                     TASKS[0])
        self.assertIsInstance(created, dict)

        fetched = db_api.task_get(TASKS[0]['workbook_name'],
                                  TASKS[0]['execution_id'],
                                  created['id'])
        self.assertIsInstance(fetched, dict)
        self.assertDictEqual(created, fetched)

        db_api.task_delete(TASKS[0]['workbook_name'],
                           TASKS[0]['execution_id'],
                           created['id'])
        self.assertIsNone(db_api.task_get(TASKS[0]['workbook_name'],
                                          TASKS[0]['execution_id'],
                                          created['id']))
    def test_task_delete(self):
        created = db_api.task_create(TASKS[0]['execution_id'],
                                     TASKS[0])
        self.assertIsInstance(created, dict)

        fetched = db_api.task_get(created['id'])
        self.assertIsInstance(fetched, dict)
        self.assertDictEqual(created, fetched)

        db_api.task_delete(created['id'])
        self.assertRaises(exc.NotFoundException, db_api.task_get,
                          created['id'])
    def test_task_update(self):
        created = db_api.task_create(TASKS[0]['execution_id'],
                                     TASKS[0])
        self.assertIsInstance(created, dict)

        updated = db_api.task_update(created['id'],
                                     {'description': 'my new desc'})
        self.assertIsInstance(updated, dict)
        self.assertEqual('my new desc', updated['description'])

        fetched = db_api.task_get(created['id'])
        self.assertDictEqual(updated, fetched)
    def test_task_update(self):
        created = db_api.task_create(TASKS[0]['workbook_name'],
                                     TASKS[0]['execution_id'], TASKS[0])
        self.assertIsInstance(created, dict)

        updated = db_api.task_update(TASKS[0]['workbook_name'],
                                     TASKS[0]['execution_id'], created['id'],
                                     {'description': 'my new desc'})
        self.assertIsInstance(updated, dict)
        self.assertEqual('my new desc', updated['description'])

        fetched = db_api.task_get(TASKS[0]['workbook_name'],
                                  TASKS[0]['execution_id'], created['id'])
        self.assertDictEqual(updated, fetched)