import pytest

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


class TestPageDetail:
    data = BaseRequest().api_load(path_setting.VISUAL_PAGE_DETAIL)
    page_detail_case, page_detail_data = get_ids(data, "page_detail")

    @pytest.mark.parametrize("param", page_detail_data, ids=page_detail_case)
    def test_page_detail(self, param):
        r = visual_request().page_detail(param["page_id"])

        assert r["error"] == param["assert"]
        assert len(r["data"]["unit_list"]) > 0
        assert r["data"]["area"] is not None
        assert r["data"]["id"] is not None
        assert r["data"]["share_data"] is not None
        assert r["data"]["name"] is not None
