import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.live_request import living_request

#@pytest.fixture(scope='function')
#def create_live():
 #   pass

class TestSendmsg:
    data = BaseRequest().api_load(path_setting.SENDMSG)
    sendmsg_case, sendmsg_data = get_ids(data, "sendmsg")

    @pytest.mark.parametrize("param",sendmsg_data,ids=sendmsg_case)
    def test_sendmsg(self,param):
        r = living_request().sendmsg(param["channel_id"],param["msg"])
        if r["error"] == 0:
            assert r["error"] == param["assert"]
        if r["error"] == 1:
            assert r["message"] == param["assert"]