def test_action_crud(self):
        runnertype = self._create_save_runnertype(metadata=False)
        saved = self._create_save_action(runnertype, metadata=False)
        retrieved = Action.get_by_id(saved.id)
        self.assertEqual(saved.name, retrieved.name,
                         'Same Action was not returned.')

        # test update
        self.assertEqual(retrieved.description, 'awesomeness')
        retrieved.description = DUMMY_DESCRIPTION
        saved = Action.add_or_update(retrieved)
        retrieved = Action.get_by_id(saved.id)
        self.assertEqual(retrieved.description, DUMMY_DESCRIPTION, 'Update to action failed.')

        # cleanup
        self._delete([retrieved])
        try:
            retrieved = Action.get_by_id(saved.id)
        except __HOLE__:
            retrieved = None
        self.assertIsNone(retrieved, 'managed to retrieve after failure.')
dataset/ETHPy150Open StackStorm/st2/st2common/tests/unit/test_db.py/ActionModelTest.test_action_crud