def test_set_channel_layout_status403(self):
        httpretty.register_uri(
                httpretty.POST,
                '%s/admin/channel39/layouts/1' % epiphan_url,
                status=403)

        with pytest.raises(requests.HTTPError) as e:
            response = WebUiChannel.set_channel_layout(
                    client=self.c, channel_id='39',
                    layout='{}')
        assert '403 Client Error' in e.value.message
    def test_live_set_channel_layout(self):
        layout = '{"video":[{"type":"source","position":{"left":"0%","top":"0%","width":"100%","height":"100%","keep_aspect_ratio":true},"settings":{"source":"D2P280762.sdi-b"}}],"audio":[{"type":"source","settings":{"source":"D2P280762.analog-b"}}],"background":"#000000","nosignal":{"id":"default"}}'

        ca_url = os.environ['EPI_URL']
        epicli = Epipearl(
                ca_url, os.environ['EPI_USER'], os.environ['EPI_PASSWD'])
        response = WebUiChannel.set_channel_layout(
                client=epicli, channel_id='2',
                layout=layout)
        assert response is not None
        r = json.loads(response)
        assert r['result']['settings'] == json.loads(layout)
    def test_set_channel_layout_ok(self):
        layout = '{"video":[{"type":"source","position":{"left":"0%","top":"0%","width":"100%","height":"100%","keep_aspect_ratio":true},"settings":{"source":"D2P280762.sdi-b"}}],"audio":[{"type":"source","settings":{"source":"D2P280762.analog-b"}}],"background":"#000000","nosignal":{"id":"default"}}'

        httpretty.register_uri(
                httpretty.POST,
                '%s/admin/channel39/layouts/1' % epiphan_url,
                body=layout, status=200)

        response = WebUiChannel.set_channel_layout(
                client=self.c, channel_id='39',
                layout=layout)
        assert response == layout