예제 #1
0
def test_add_properties(mock_send_message_json):
    pnf = Pnf(name="test")
    pnf._identifier = "toto"
    pnf._unique_identifier = "toto"
    pnf._status = const.CERTIFIED
    with pytest.raises(StatusError) as err:
        pnf.add_property(Property(name="test", property_type="string"))
    pnf._status = const.DRAFT
    pnf.add_property(Property(name="test", property_type="string"))
    mock_send_message_json.assert_called_once()
예제 #2
0
def test_submit_not_Commited(mock_send, mock_load, mock_exists, status):
    """Do nothing if not created."""
    mock_exists.return_value = False
    pnf = Pnf()
    pnf._status = status
    pnf.submit()
    mock_send.assert_not_called()
예제 #3
0
def test_submit_OK(mock_send, mock_load, mock_exists):
    """Don't update status if submission NOK."""
    mock_exists.return_value = True
    pnf = Pnf()
    pnf._status = const.COMMITED
    expected_data = '{\n  "userRemarks": "certify"\n}'
    pnf._version = "1234"
    pnf._unique_identifier = "12345"
    pnf.submit()
    mock_send.assert_called_once_with(
        "POST",
        "Certify Pnf",
        'https://sdc.api.fe.simpledemo.onap.org:30207/sdc1/feProxy/rest/v1/catalog/resources/12345/lifecycleState/Certify',
        data=expected_data)