@testing.requires.two_phase_transactions
def test_reset_via_agent_begin_twophase_commit(self):
    canary = mock.Mock()
    with testing.db.connect() as connection:
        event.listen(connection, 'rollback', canary.rollback)
        event.listen(connection, 'commit', canary.commit)
        event.listen(connection, 'commit_twophase', canary.commit_twophase)
        trans = connection.begin_twophase()
        assert (connection.connection._reset_agent is trans)
        trans.commit()
        assert (connection.connection._reset_agent is None)
    eq_(canary.mock_calls, [mock.call.commit_twophase(connection, mock.ANY, False)])
@testing.requires.two_phase_transactions
def test_reset_via_agent_begin_twophase_commit(self):
    canary = mock.Mock()
    with testing.db.connect() as connection:
        event.listen(connection, 'rollback', canary.rollback)
        event.listen(connection, 'commit', canary.commit)
        event.listen(connection, 'commit_twophase', canary.commit_twophase)
        trans = connection.begin_twophase()
        assert (connection.connection._reset_agent is trans)
        trans.commit()
        assert (connection.connection._reset_agent is None)
    eq_(canary.mock_calls, [mock.call.commit_twophase(connection, mock.ANY, False)])