import pytest

from all_backend_api.user_request import user_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest


class TestAnswer:
    data = BaseRequest().api_load(path_setting.USER_ANSWER)
    answer_case, answer_data = get_ids(data, "answer")

    @pytest.mark.parametrize("param", answer_data, ids=answer_case)
    def test_answer(self, param):
        r = user_request().answer(param["user"])

        if r["error"] == 0:
            assert r["error"] == param["assert_error"]
