def test_action_email():
    action_str = '{"name": "email" , "endpoint":"*****@*****.**"}'
    action = Actions(actions_str=action_str, rule_name="test_rule")
    action.invoke()
    email_action = action._actions[0]
    assert email_action._last_subscription_response is not None
    assert email_action._last_send_mesg_response is not None
def test_action_sms():
    action_str = '{"name": "sms" , "endpoint":"+11234567890"}'
    action = Actions(actions_str=action_str, rule_name="test_rule")
    action.invoke()
    sms_action = action._actions[0]
    assert sms_action._last_subscription_response is not None
    assert sms_action._last_send_mesg_response is not None
def test_action_stop_training_job():
    action_str = '{"name": "stoptraining" , "training_job_prefix":"training_prefix"}'
    action = Actions(actions_str=action_str)
    action.invoke()
def test_invalid_message_action():
    action_str = '{"name": "invalid" , "invalid":"*****@*****.**"}'
    action = Actions(actions_str=action_str, rule_name="test_rule")
    action.invoke()
def test_action_email_invalid_params():
    action_str = '{"name": "email" , "invalid":"*****@*****.**"}'
    action = Actions(actions_str=action_str, rule_name="test_rule")
    action.invoke()
def test_action_sms_invalid_params():
    action_str = '{"name": "sms" , "invalid":"+11234567890"}'
    action = Actions(actions_str=action_str, rule_name="test_rule")
    action.invoke()
def test_action_stop_training_job_invalid_params():
    action_str = '{"name": "stoptraining" , "invalid_job_prefix":"training_prefix"}'
    action = Actions(actions_str=action_str, rule_name="test_rule")
    action.invoke()