def test_commit_multiple_objects(self):
        db_api.start_tx()

        try:
            created = db_api.create_listener(LISTENERS[0])
            fetched = db_api.get_listener(created.name)

            self.assertEqual(created, fetched)

            created_wb = db_api.create_member(MEMBERS[0])
            fetched_wb = db_api.get_member(created_wb.name)

            self.assertEqual(created_wb, fetched_wb)
            self.assertTrue(self.is_db_session_open())

            db_api.commit_tx()
        finally:
            db_api.end_tx()

        self.assertFalse(self.is_db_session_open())

        fetched = db_api.get_listener(created.name)

        self.assertEqual(created, fetched)

        fetched_wb = db_api.get_member(created_wb.name)

        self.assertEqual(created_wb, fetched_wb)
        self.assertFalse(self.is_db_session_open())
示例#2
0
    def test_commit_multiple_objects(self):
        db_api.start_tx()

        try:
            created = db_api.create_listener(LISTENERS[0])
            fetched = db_api.get_listener(created.name)

            self.assertEqual(created, fetched)

            created_wb = db_api.create_member(MEMBERS[0])
            fetched_wb = db_api.get_member(created_wb.name)

            self.assertEqual(created_wb, fetched_wb)
            self.assertTrue(self.is_db_session_open())

            db_api.commit_tx()
        finally:
            db_api.end_tx()

        self.assertFalse(self.is_db_session_open())

        fetched = db_api.get_listener(created.name)

        self.assertEqual(created, fetched)

        fetched_wb = db_api.get_member(created_wb.name)

        self.assertEqual(created_wb, fetched_wb)
        self.assertFalse(self.is_db_session_open())
示例#3
0
    def test_rollback_multiple_objects(self):
        db_api.start_tx()

        try:
            created = db_api.create_listener(LISTENERS[0])
            fetched = db_api.get_listener(created['name'])

            self.assertEqual(created, fetched)

            created_wb = db_api.create_member(MEMBERS[0])
            fetched_wb = db_api.get_member(created_wb.name)

            self.assertEqual(created_wb, fetched_wb)
            self.assertTrue(self.is_db_session_open())

            db_api.rollback_tx()
        finally:
            db_api.end_tx()

        self.assertFalse(self.is_db_session_open())
        self.assertRaises(
            exc.NotFoundException,
            db_api.get_listener,
            created.name
        )
        self.assertRaises(
            exc.NotFoundException,
            db_api.get_member,
            created_wb.name
        )

        self.assertFalse(self.is_db_session_open())
    def test_rollback(self):
        db_api.start_tx()

        try:
            created = db_api.create_member(MEMBERS[0])
            fetched = db_api.get_member(created.name)

            self.assertEqual(created, fetched)
            self.assertTrue(self.is_db_session_open())

            db_api.rollback_tx()
        finally:
            db_api.end_tx()

        self.assertFalse(self.is_db_session_open())
        self.assertRaises(exc.NotFoundException, db_api.get_member, created["id"])
        self.assertFalse(self.is_db_session_open())
    def test_commit(self):
        db_api.start_tx()

        try:
            created = db_api.create_member(MEMBERS[0])
            fetched = db_api.get_member(created.name)

            self.assertEqual(created, fetched)
            self.assertTrue(self.is_db_session_open())

            db_api.commit_tx()
        finally:
            db_api.end_tx()

        self.assertFalse(self.is_db_session_open())

        fetched = db_api.get_member(created.name)

        self.assertEqual(created, fetched)
        self.assertFalse(self.is_db_session_open())
示例#6
0
    def test_commit(self):
        db_api.start_tx()

        try:
            created = db_api.create_member(MEMBERS[0])
            fetched = db_api.get_member(created.name)

            self.assertEqual(created, fetched)
            self.assertTrue(self.is_db_session_open())

            db_api.commit_tx()
        finally:
            db_api.end_tx()

        self.assertFalse(self.is_db_session_open())

        fetched = db_api.get_member(created.name)

        self.assertEqual(created, fetched)
        self.assertFalse(self.is_db_session_open())
示例#7
0
    def test_rollback(self):
        db_api.start_tx()

        try:
            created = db_api.create_member(MEMBERS[0])
            fetched = db_api.get_member(created.name)

            self.assertEqual(created, fetched)
            self.assertTrue(self.is_db_session_open())

            db_api.rollback_tx()
        finally:
            db_api.end_tx()

        self.assertFalse(self.is_db_session_open())
        self.assertRaises(
            exc.NotFoundException,
            db_api.get_member,
            created['id']
        )
        self.assertFalse(self.is_db_session_open())
    def test_rollback_multiple_objects(self):
        db_api.start_tx()

        try:
            created = db_api.create_listener(LISTENERS[0])
            fetched = db_api.get_listener(created["name"])

            self.assertEqual(created, fetched)

            created_wb = db_api.create_member(MEMBERS[0])
            fetched_wb = db_api.get_member(created_wb.name)

            self.assertEqual(created_wb, fetched_wb)
            self.assertTrue(self.is_db_session_open())

            db_api.rollback_tx()
        finally:
            db_api.end_tx()

        self.assertFalse(self.is_db_session_open())
        self.assertRaises(exc.NotFoundException, db_api.get_listener, created.name)
        self.assertRaises(exc.NotFoundException, db_api.get_member, created_wb.name)

        self.assertFalse(self.is_db_session_open())