def test_triggertype_crud(self):
        saved = ReactorModelTest._create_save_triggertype()
        retrieved = TriggerType.get_by_id(saved.id)
        self.assertEqual(saved.name, retrieved.name,
                         'Same triggertype was not returned.')
        # test update
        self.assertEqual(retrieved.description, '')
        retrieved.description = DUMMY_DESCRIPTION
        saved = TriggerType.add_or_update(retrieved)
        retrieved = TriggerType.get_by_id(saved.id)
        self.assertEqual(retrieved.description, DUMMY_DESCRIPTION, 'Update to trigger failed.')
        # cleanup
        ReactorModelTest._delete([retrieved])
        try:
            retrieved = TriggerType.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/ReactorModelTest.test_triggertype_crud