def test_version_no_load_created(mock_load): """Test versions when created.""" vf = Vf() vf.identifier = "1234" vf._version = "64" assert vf.version == "64" mock_load.assert_not_called()
def test__get_items_version_details(mock_send): vf = Vf() vf.identifier = "1234" vf._version = "4567" mock_send.return_value = {'return': 'value'} assert vf._get_item_version_details() == {'return': 'value'} mock_send.assert_called_once_with( 'GET', 'get item version', "{}/items/1234/versions/4567".format(vf._base_url()))
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))