예제 #1
0
def test_save_user_config_denied(mocker, monkeypatch):
    monkeypatch.setattr(config.user, "may", lambda x: x != "general.configure_sidebar")
    save_user_file_mock = mocker.patch.object(config.user, "save_file")
    user_config = sidebar.UserSidebarConfig(config.user, config.sidebar)
    user_config.save()
    save_user_file_mock.assert_not_called()
예제 #2
0
def test_user_config_add_snapin():
    user_config = sidebar.UserSidebarConfig(config.user, config.sidebar)
    del user_config.snapins[:]
    snapin = UserSidebarSnapin.from_snapin_type_id("tactical_overview")
    user_config.add_snapin(snapin)
    assert user_config.snapins == [snapin]