예제 #1
0
def test_submit_not_Commited(mock_send, mock_load, mock_exists, status):
    """Do nothing if not created."""
    mock_exists.return_value = False
    vf = Vf()
    vf._status = status
    vf.submit()
    mock_send.assert_not_called()
예제 #2
0
def test_submit_OK(mock_send, mock_load, mock_exists):
    """Don't update status if submission NOK."""
    mock_exists.return_value = True
    vf = Vf()
    vf._status = const.COMMITED
    expected_data = '{\n  "userRemarks": "certify"\n}'
    vf._version = "1234"
    vf._unique_identifier = "12345"
    vf.submit()
    mock_send.assert_called_once_with(
        "POST",
        "Certify Vf",
        'https://sdc.api.fe.simpledemo.onap.org:30207/sdc1/feProxy/rest/v1/catalog/resources/12345/lifecycleState/Certify',
        data=expected_data)
def test__deep_load_no_response(mock_send, mock_created):
    mock_created.return_value = True
    vf = Vf()
    vf.identifier = "1234"
    vf._version = "4567"
    vf._status = const.CHECKED_IN
    mock_send.return_value = {}
    vf.deep_load()
    assert vf._unique_identifier is None
    mock_send.assert_called_once_with(
        'GET',
        'Deep Load Vf',
        "{}/sdc1/feProxy/rest/v1/screen?excludeTypes=VFCMT&excludeTypes=Configuration"
        .format(vf.base_front_url),
        headers=headers_sdc_creator(vf.headers))
def test__deep_load_response_NOK_under_cert(mock_send, mock_created):
    mock_created.return_value = True
    vf = Vf()
    vf.identifier = "5678"
    vf._version = "4567"
    vf._status = const.UNDER_CERTIFICATION
    mock_send.return_value = {
        'resources': [{
            'uuid': '5689',
            'name': 'test',
            'uniqueId': '71011'
        }]
    }
    vf.deep_load()
    assert vf._unique_identifier is None
    mock_send.assert_called_once_with(
        'GET',
        'Deep Load Vf',
        "{}/sdc1/feProxy/rest/v1/screen?excludeTypes=VFCMT&excludeTypes=Configuration"
        .format(vf.base_front_url),
        headers=headers_sdc_tester(vf.headers))