def test_create_and_get_and_load_listener(self):
        created = db_api.create_listener(LISTENERS[0])

        fetched = db_api.get_listener(created.name)

        self.assertEqual(created, fetched)

        fetched = db_api.load_listener(created.name)

        self.assertEqual(created, fetched)

        self.assertIsNone(db_api.load_listener("not-existing-id"))
Beispiel #2
0
    def test_create_and_get_and_load_listener(self):
        created = db_api.create_listener(LISTENERS[0])

        fetched = db_api.get_listener(created.name)

        self.assertEqual(created, fetched)

        fetched = db_api.load_listener(created.name)

        self.assertEqual(created, fetched)

        self.assertIsNone(db_api.load_listener("not-existing-id"))
    def test_create_or_update_listener(self):
        name = "not-existing-id"

        self.assertIsNone(db_api.load_listener(name))

        created = db_api.create_or_update_listener(name, LISTENERS[0])

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

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

        self.assertEqual("my new desc", updated.description)
        self.assertEqual("my new desc", db_api.load_listener(updated.name).description)

        fetched = db_api.get_listener(created.name)

        self.assertEqual(updated, fetched)
Beispiel #4
0
    def test_create_or_update_listener(self):
        name = 'not-existing-id'

        self.assertIsNone(db_api.load_listener(name))

        created = db_api.create_or_update_listener(name, LISTENERS[0])

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

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

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

        fetched = db_api.get_listener(created.name)

        self.assertEqual(updated, fetched)