def test_get_validations_db(mock_get_validation_by_action_id): expected = { 'id': '43', 'action_id': '12345678901234567890123456', 'validation_name': 'It has shiny goodness', 'details': 'This was not very shiny.' } mock_get_validation_by_action_id.return_value = expected action_resource = ActionsIdResource() action_id = 'test_action_id' result = action_resource.get_validations_db(action_id) mock_get_validation_by_action_id.assert_called_once_with( action_id=action_id) assert result == expected
def test_get_action_success(): """ Tests the main response from get all actions """ action_resource = ActionsIdResource() # stubs for db action_resource.get_action_db = actions_db action_resource.get_dag_run_db = dag_runs_db action_resource.get_tasks_db = tasks_db action_resource.get_validations_db = get_validations action_resource.get_action_command_audit_db = get_ac_audit action = action_resource.get_action('12345678901234567890123456') if action['name'] == 'dag_it': assert len(action['steps']) == 3 assert action['dag_status'] == 'FAILED' assert len(action['command_audit']) == 2