示例#1
0
def test_rollback_nowhere_to_go(get_current, set_current):
    get_current.return_value = 'aaa'
    with mock_history(initial=['aaa']) as releases:
        with pytest.raises(RuntimeError):
            rollback()
        assert releases == ['aaa']
    assert_has_calls(set_current, [])
示例#2
0
def test_rollback(get_current, set_current):
    get_current.return_value = 'bbb'
    with mock_history(initial=['aaa', 'bbb']) as releases:
        rollback()
        assert releases == ['aaa']
    assert_called_once_with(set_current, 'aaa')