예제 #1
0
    def test_export_channel_status(self, client: StreamChat, channel: Channel):
        with pytest.raises(StreamAPIException, match=r".*Can't find task.*"):
            client.get_export_channel_status(str(uuid.uuid4()))

        with pytest.raises(StreamAPIException,
                           match=r".*Can't find channel.*"):
            client.export_channel("messaging", str(uuid.uuid4()))
예제 #2
0
    def test_export_channel(self, client: StreamChat, channel: Channel,
                            random_users: List[Dict]):
        channel.send_message({"text": "Hey Joni"}, random_users[0]["id"])

        resp = client.export_channel(channel.channel_type, channel.id)
        task_id = resp["task_id"]
        assert task_id != ""

        while True:
            resp = client.get_export_channel_status(task_id)
            assert resp["status"] != ""
            assert resp["created_at"] != ""
            assert resp["updated_at"] != ""
            if resp["status"] == "completed":
                assert len(resp["result"]) != 0
                assert resp["result"]["url"] != ""
                assert "error" not in resp
                break
            time.sleep(0.5)