def test_create_or_update_action_definition(self):
        name = 'not-existing-id'

        self.assertIsNone(db_api.load_action_definition(name))

        created = db_api.create_or_update_action_definition(
            name,
            ACTION_DEFINITIONS[0]
        )

        self.assertIsNotNone(created)
        self.assertIsNotNone(created.name)

        updated = db_api.create_or_update_action_definition(
            created.name,
            {'description': 'my new desc'}
        )

        self.assertEqual('my new desc', updated.description)
        self.assertEqual(
            'my new desc',
            db_api.load_action_definition(updated.name).description
        )

        fetched = db_api.get_action_definition(created.name)

        self.assertEqual(updated, fetched)
    def test_create_and_get_and_load_action_definition(self):
        created = db_api.create_action_definition(ACTION_DEFINITIONS[0])

        fetched = db_api.get_action_definition(created.name)

        self.assertEqual(created, fetched)

        fetched = db_api.load_action_definition(created.name)

        self.assertEqual(created, fetched)

        self.assertIsNone(db_api.load_action_definition("not-existing-id"))
Esempio n. 3
0
    def test_create_and_get_and_load_action_definition(self):
        created = db_api.create_action_definition(ACTION_DEFINITIONS[0])

        fetched = db_api.get_action_definition(created.name)

        self.assertEqual(created, fetched)

        fetched = db_api.load_action_definition(created.name)

        self.assertEqual(created, fetched)

        self.assertIsNone(db_api.load_action_definition("not-existing-id"))
Esempio n. 4
0
    def test_create_or_update_action_definition(self):
        name = 'not-existing-id'

        self.assertIsNone(db_api.load_action_definition(name))

        created = db_api.create_or_update_action_definition(
            name, ACTION_DEFINITIONS[0])

        self.assertIsNotNone(created)
        self.assertIsNotNone(created.name)

        updated = db_api.create_or_update_action_definition(
            created.name, {'description': 'my new desc'})

        self.assertEqual('my new desc', updated.description)
        self.assertEqual(
            'my new desc',
            db_api.load_action_definition(updated.name).description)

        fetched = db_api.get_action_definition(created.name)

        self.assertEqual(updated, fetched)