Esempio n. 1
0
def test_restart_peer_groups():
    frr = MagicMock()
    c = ConfigMgr(frr)
    c.restart_peer_groups(["pg_1", "pg_2"])
    assert c.peer_groups_to_restart == ["pg_1", "pg_2"]
    c.restart_peer_groups(["pg_3", "pg_4"])
    assert c.peer_groups_to_restart == ["pg_1", "pg_2", "pg_3", "pg_4"]
Esempio n. 2
0
def commit_changes_common(write_error, restart_error, result):
    frr = MagicMock()
    frr.write = MagicMock(return_value=write_error)
    frr.restart_peer_groups = MagicMock(return_value=restart_error)
    c = ConfigMgr(frr)
    c.reset = MagicMock()
    c.push_list(["change1", "change2"])
    c.restart_peer_groups(["pg1", "pg2"])
    res = c.commit()
    assert res == result
    assert c.reset.called
    frr.write.assert_called_with('change1\nchange2\n')
    frr.restart_peer_groups.assert_called_with(["pg1", "pg2"])