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()
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_vf_unknown(): """Integration tests for Vf.""" response = requests.post("{}/reset".format(Vendor.base_front_url)) response.raise_for_status() vendor = Vendor(name="test") vendor.onboard() vsp = Vsp(name="test", package=open( "{}/ubuntu16.zip".format( os.path.dirname(os.path.abspath(__file__))), 'rb')) vsp.vendor = vendor vsp.onboard() vf = Vf(name='test') vf.vsp = vsp vf.create() assert vf.identifier is not None assert vf.status == const.DRAFT assert vf.version == "0.1" vf.submit() assert vsp.status == const.CERTIFIED assert vf.version == "1.0" vf.load() assert vsp.status == const.CERTIFIED assert vf.version == "1.0"