Ejemplo n.º 1
0
def test_init_no_name(mock_created):
    """Check init with no names."""
    mock_created.return_value = False
    vsp = Vsp()
    assert isinstance(vsp, SdcElement)
    assert vsp._identifier == None
    assert vsp._version == None
    assert vsp.name == "ONAP-test-VSP"
    assert vsp.headers["USER_ID"] == "cs0008"
    assert vsp.vendor == None
    assert isinstance(vsp._base_url(), str)
    assert "sdc1/feProxy/onboarding-api/v1.0" in vsp._base_url()
Ejemplo n.º 2
0
def test_init_with_name(mock_exists):
    """Check init with no names."""
    vsp = Vsp(name="YOLO")
    mock_exists.return_value = False
    assert vsp._identifier == None
    assert vsp._version == None
    assert vsp.name == "YOLO"
    assert vsp.created() == False
    assert vsp.headers["USER_ID"] == "cs0008"
    assert vsp.vendor == None
    assert isinstance(vsp._base_url(), str)
    assert "sdc1/feProxy/onboarding-api/v1.0" in vsp._base_url()
def test__get_item_details_created(mock_send):
    vsp = Vsp()
    vsp.identifier = "1234"
    mock_send.return_value = {'return': 'value'}
    assert vsp._get_item_details() == {'return': 'value'}
    mock_send.assert_called_once_with(
        'GET', 'get item', "{}/items/1234/versions".format(vsp._base_url()))
Ejemplo n.º 4
0
def test__get_vsp_details(mock_send):
    vsp = Vsp()
    vsp.identifier = "1234"
    vsp._version = "4567"
    mock_send.return_value = {'return': 'value'}
    assert vsp._get_vsp_details() == {'return': 'value'}
    mock_send.assert_called_once_with('GET', 'get vsp version', "{}/vendor-software-products/1234/versions/4567".format(vsp._base_url()))