MCPcopy Create free account
hub / github.com/slackapi/python-slack-sdk / test_sync

Method test_sync

integration_tests/web/test_canvases.py:24–93  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

22 pass
23
24 def test_sync(self):
25 client = self.sync_client
26
27 # Channel canvas
28 new_channel = client.conversations_create(name=f"test-{str(time.time()).replace('.', '-')}")
29 channel_id = new_channel["channel"]["id"]
30 channel_canvas = client.conversations_canvases_create(
31 channel_id=channel_id,
32 document_content={
33 "type": "markdown",
34 "markdown": """# My canvas
35
36## Hey
37
38What's up?
39
40- foo
41- bar
42""",
43 },
44 )
45 self.assertIsNone(channel_canvas.get("error"))
46
47 # Standalone canvas
48 standalone_canvas = client.canvases_create(
49 title="My canvas",
50 document_content={
51 "type": "markdown",
52 "markdown": """# My canvas
53
54## Hey
55
56What's up?
57
58- foo
59- bar
60""",
61 },
62 )
63 self.assertIsNone(standalone_canvas.get("error"))
64 canvas_id = standalone_canvas.get("canvas_id")
65
66 sections = client.canvases_sections_lookup(canvas_id=canvas_id, criteria={"contains_text": "Hey"})
67 section_id = sections["sections"][0]["id"]
68
69 edit = client.canvases_edit(
70 canvas_id=canvas_id,
71 changes=[
72 {
73 "operation": "replace",
74 "section_id": section_id,
75 "document_content": {"type": "markdown", "markdown": "## Hey Hey"},
76 }
77 ],
78 )
79 self.assertIsNone(edit.get("error"))
80
81 user_id = client.auth_test()["user_id"]

Callers

nothing calls this directly

Calls 10

conversations_createMethod · 0.45
getMethod · 0.45
canvases_createMethod · 0.45
canvases_editMethod · 0.45
auth_testMethod · 0.45
canvases_access_setMethod · 0.45
canvases_deleteMethod · 0.45

Tested by

no test coverage detected