예제 #1
0
    def test_delete_action_execution(self):
        created = db_api.create_action_execution(ACTION_EXECS[0])

        fetched = db_api.get_action_execution(created.id)

        self.assertEqual(created, fetched)

        db_api.delete_action_execution(created.id)

        self.assertRaises(exc.NotFoundException, db_api.get_action_execution,
                          created.id)
예제 #2
0
    def test_create_and_get_and_load_action_execution(self):
        created = db_api.create_action_execution(ACTION_EXECS[0])

        fetched = db_api.get_action_execution(created.id)

        self.assertEqual(created, fetched)

        fetched = db_api.load_action_execution(created.id)

        self.assertEqual(created, fetched)

        self.assertIsNone(db_api.load_action_execution("not-existing-id"))
예제 #3
0
    def test_create_and_get_and_load_action_execution(self):
        created = db_api.create_action_execution(ACTION_EXECS[0])

        fetched = db_api.get_action_execution(created.id)

        self.assertEqual(created, fetched)

        fetched = db_api.load_action_execution(created.id)

        self.assertEqual(created, fetched)

        self.assertIsNone(db_api.load_action_execution("not-existing-id"))
예제 #4
0
    def test_delete_action_execution(self):
        created = db_api.create_action_execution(ACTION_EXECS[0])

        fetched = db_api.get_action_execution(created.id)

        self.assertEqual(created, fetched)

        db_api.delete_action_execution(created.id)

        self.assertRaises(
            exc.NotFoundException,
            db_api.get_action_execution,
            created.id
        )
예제 #5
0
    def test_update_action_execution(self):
        created = db_api.create_action_execution(ACTION_EXECS[0])

        self.assertIsNone(created.updated_at)

        updated = db_api.update_execution(created.id, {
            'state': 'RUNNING',
            'state_info': "Running..."
        })

        self.assertEqual('RUNNING', updated.state)
        self.assertEqual('RUNNING',
                         db_api.load_action_execution(updated.id).state)

        fetched = db_api.get_action_execution(created.id)

        self.assertEqual(updated, fetched)
        self.assertIsNotNone(fetched.updated_at)
예제 #6
0
    def test_update_action_execution(self):
        created = db_api.create_action_execution(ACTION_EXECS[0])

        self.assertIsNone(created.updated_at)

        updated = db_api.update_execution(
            created.id,
            {'state': 'RUNNING', 'state_info': "Running..."}
        )

        self.assertEqual('RUNNING', updated.state)
        self.assertEqual(
            'RUNNING',
            db_api.load_action_execution(updated.id).state
        )

        fetched = db_api.get_action_execution(created.id)

        self.assertEqual(updated, fetched)
        self.assertIsNotNone(fetched.updated_at)
예제 #7
0
    def test_create_or_update_action_execution(self):
        id = 'not-existing-id'

        self.assertIsNone(db_api.load_action_execution(id))

        created = db_api.create_or_update_action_execution(id, ACTION_EXECS[0])

        self.assertIsNotNone(created)
        self.assertIsNotNone(created.id)

        updated = db_api.create_or_update_action_execution(
            created.id, {'state': 'RUNNING'})

        self.assertEqual('RUNNING', updated.state)
        self.assertEqual('RUNNING',
                         db_api.load_action_execution(updated.id).state)

        fetched = db_api.get_action_execution(created.id)

        self.assertEqual(updated, fetched)
예제 #8
0
    def test_create_or_update_action_execution(self):
        id = 'not-existing-id'

        self.assertIsNone(db_api.load_action_execution(id))

        created = db_api.create_or_update_action_execution(id, ACTION_EXECS[0])

        self.assertIsNotNone(created)
        self.assertIsNotNone(created.id)

        updated = db_api.create_or_update_action_execution(
            created.id,
            {'state': 'RUNNING'}
        )

        self.assertEqual('RUNNING', updated.state)
        self.assertEqual(
            'RUNNING',
            db_api.load_action_execution(updated.id).state
        )

        fetched = db_api.get_action_execution(created.id)

        self.assertEqual(updated, fetched)