Beispiel #1
0
def test_service_instance_add_vnf(mock_vnf_instantiation):
    service_instance = ServiceInstance(service_subscription=mock.MagicMock(),
                                       instance_id="test_service_instance_id")
    service_instance.orchestration_status = "Inactive"
    with pytest.raises(AttributeError):
        service_instance.add_vnf(mock.MagicMock(), mock.MagicMock(),
                                 mock.MagicMock())
    service_instance.orchestration_status = "Active"
    service_instance.add_vnf(mock.MagicMock(), mock.MagicMock(),
                             mock.MagicMock())
    mock_vnf_instantiation.assert_called_once()
Beispiel #2
0
def test_service_instance_add_vnf(mock_sdc_service, mock_vnf_instantiation):
    service_instance = ServiceInstance(service_subscription=mock.MagicMock(),
                                       instance_id="test_service_instance_id")
    service_instance.orchestration_status = "Inactive"
    with pytest.raises(StatusError) as exc:
        service_instance.add_vnf(mock.MagicMock(), mock.MagicMock(),
                                 mock.MagicMock())
    assert exc.type == StatusError
    service_instance.orchestration_status = "Active"
    service_instance.add_vnf(mock.MagicMock(), mock.MagicMock(),
                             mock.MagicMock())
    mock_vnf_instantiation.assert_called_once()