import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.janus_request import janus_request


class TestPolling:
    data = BaseRequest().api_load(path_setting.POLLING)
    polling_case, polling_data = get_ids(data, "polling")
    print('polling_data:',polling_data)
    @pytest.mark.parametrize("param",polling_data,ids=polling_case)
    def test_polling(self,param):
        print(param)
        r = janus_request().polling(param["stream_id"],param["is_first"])
        print(r)
        if r["error"] == 0:
            assert r["data"]["delay"] == param["assert"]