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