コード例 #1
0
def test_add_properties(mock_send_message_json):
    service = Service(name="test")
    service._identifier = "toto"
    service._unique_identifier = "toto"
    service._status = const.CERTIFIED
    with pytest.raises(AttributeError):
        service.add_property(Property(name="test", property_type="string"))
    service._status = const.DRAFT
    service.add_property(Property(name="test", property_type="string"))
    mock_send_message_json.assert_called_once()
コード例 #2
0
def test_verify_action_to_sdc_bad_status(mock_created, mock_action, mock_load):
    mock_created.return_value = True
    svc = Service()
    svc._status = "no_yes"
    svc._verify_action_to_sdc("yes", "action", action_type='lifecycleState')
    mock_created.assert_called()
    mock_action.assert_not_called()
    mock_load.assert_not_called()
コード例 #3
0
def test_verify_action_to_sdc_OK(mock_created, mock_action, mock_load):
    mock_created.return_value = True
    mock_action.return_value = "good"
    svc = Service()
    svc._status = "yes"
    svc._verify_action_to_sdc("yes", "action", action_type='lifecycleState')
    mock_created.assert_called()
    mock_action.assert_called_once()
    mock_load.assert_called_once()