示例#1
0
def test_deploy_links(mock_deploy_link, docker_link, progress_bar):
    lab = Lab("Default scenario")
    link_a = lab.get_or_new_link("A")
    link_b = lab.get_or_new_link("B")
    link_c = lab.get_or_new_link("C")
    docker_link.deploy_links(lab)
    mock_deploy_link.assert_any_call(None, ("A", link_a))
    mock_deploy_link.assert_any_call(None, ("B", link_b))
    mock_deploy_link.assert_any_call(None, ("C", link_c))
    assert mock_deploy_link.call_count == 3
示例#2
0
def undeploy(mock_get_links_by_filters, mock_undeploy_link, kubernetes_network):
    lab = Lab("Default scenario")
    lab.get_or_new_link("A")
    lab.get_or_new_link("B")
    lab.get_or_new_link("C")
    mock_get_links_by_filters.return_value = [kubernetes_network, kubernetes_network, kubernetes_network]

    kubernetes_link.undeploy("lab_hash")

    mock_get_links_by_filters.called_once_with(lab.hash)
    assert mock_undeploy_link.call_count == 3
示例#3
0
def test_wipe(mock_get_links_by_filters, mock_net1, mock_net2, mock_net3,
              mock_undeploy_link, docker_link):
    lab = Lab("Default scenario")
    lab.get_or_new_link("A")
    lab.get_or_new_link("B")
    lab.get_or_new_link("C")
    mock_get_links_by_filters.return_value = [mock_net1, mock_net2, mock_net3]
    docker_link.wipe()
    mock_get_links_by_filters.called_once_with(lab.hash)
    assert mock_net1.reload.call_count == 1
    assert mock_net2.reload.call_count == 1
    assert mock_net3.reload.call_count == 1
    assert mock_undeploy_link.call_count == 3
示例#4
0
def test_get_or_new_link_exists(default_scenario: Lab):
    default_scenario.get_or_new_link("A")
    default_scenario.get_or_new_link("A")
    assert len(default_scenario.links) == 1
    assert default_scenario.links['A']
示例#5
0
def test_get_or_new_link_two_cd(default_scenario: Lab):
    default_scenario.get_or_new_link("A")
    default_scenario.get_or_new_link("B")
    assert len(default_scenario.links) == 2
    assert default_scenario.links['A']
    assert default_scenario.links['B']