def test_status_no_load_created(mock_load, mock_created): mock_created.return_value = True vendor = Vendor() vendor.identifier = "12345" vendor._status = "Draft" assert vendor.status == "Draft" mock_load.assert_not_called()
def test_submit_already_certified(mock_send, mock_load, mock_exists): """Do nothing if already certified.""" mock_exists.return_value = True vendor = Vendor() vendor._status = const.CERTIFIED vendor.submit() mock_send.assert_not_called()
def test_submit_certified_OK(mock_send, mock_load, mock_exists): """Set status to CERTIFIED if submission OK.""" mock_exists.return_value = True vendor = Vendor() vendor._status = "Draft" vendor._version = "1234" vendor.identifier = "12345" mock_send.return_value = mock.Mock() expected_data = '{\n\n "action": "Submit"\n}' vendor.submit() mock_send.assert_called_once_with( "PUT", "Submit Vendor", 'https://sdc.api.fe.simpledemo.onap.org:30207/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models/12345/versions/1234/actions', data=expected_data) assert vendor.status == const.CERTIFIED