|
21 | 21 | Option, |
22 | 22 | OverflowMenuElement, |
23 | 23 | PlainTextObject, |
| 24 | + PlanBlock, |
24 | 25 | RawTextObject, |
25 | 26 | RichTextBlock, |
26 | 27 | RichTextElementParts, |
|
31 | 32 | SectionBlock, |
32 | 33 | StaticSelectElement, |
33 | 34 | TableBlock, |
| 35 | + TaskCardBlock, |
34 | 36 | VideoBlock, |
35 | 37 | ) |
36 | 38 | from slack_sdk.models.blocks.basic_components import FeedbackButtonObject, SlackFile |
@@ -890,6 +892,87 @@ def test_text_length_12001(self): |
890 | 892 | MarkdownBlock(**input).validate_json() |
891 | 893 |
|
892 | 894 |
|
| 895 | +# ---------------------------------------------- |
| 896 | +# Plan |
| 897 | +# ---------------------------------------------- |
| 898 | + |
| 899 | + |
| 900 | +class PlanBlockTests(unittest.TestCase): |
| 901 | + def test_document(self): |
| 902 | + input = { |
| 903 | + "type": "plan", |
| 904 | + "plan_id": "plan_1", |
| 905 | + "title": "Thinking completed", |
| 906 | + "tasks": [ |
| 907 | + { |
| 908 | + "task_id": "call_001", |
| 909 | + "title": "Fetched user profile information", |
| 910 | + "status": "in_progress", |
| 911 | + "details": { |
| 912 | + "type": "rich_text", |
| 913 | + "elements": [ |
| 914 | + {"type": "rich_text_section", "elements": [{"type": "text", "text": "Searched database..."}]} |
| 915 | + ], |
| 916 | + }, |
| 917 | + "output": { |
| 918 | + "type": "rich_text", |
| 919 | + "elements": [ |
| 920 | + {"type": "rich_text_section", "elements": [{"type": "text", "text": "Profile data loaded"}]} |
| 921 | + ], |
| 922 | + }, |
| 923 | + }, |
| 924 | + { |
| 925 | + "task_id": "call_002", |
| 926 | + "title": "Checked user permissions", |
| 927 | + "status": "pending", |
| 928 | + }, |
| 929 | + { |
| 930 | + "task_id": "call_003", |
| 931 | + "title": "Generated comprehensive user report", |
| 932 | + "status": "complete", |
| 933 | + "output": { |
| 934 | + "type": "rich_text", |
| 935 | + "elements": [ |
| 936 | + {"type": "rich_text_section", "elements": [{"type": "text", "text": "15 data points compiled"}]} |
| 937 | + ], |
| 938 | + }, |
| 939 | + }, |
| 940 | + ], |
| 941 | + } |
| 942 | + self.assertDictEqual(input, PlanBlock(**input).to_dict()) |
| 943 | + self.assertDictEqual(input, Block.parse(input).to_dict()) |
| 944 | + |
| 945 | + |
| 946 | +# ---------------------------------------------- |
| 947 | +# Task card |
| 948 | +# ---------------------------------------------- |
| 949 | + |
| 950 | + |
| 951 | +class TaskCardBlockTests(unittest.TestCase): |
| 952 | + def test_document(self): |
| 953 | + input = { |
| 954 | + "type": "task_card", |
| 955 | + "task_id": "task_1", |
| 956 | + "title": "Fetching weather data", |
| 957 | + "status": "pending", |
| 958 | + "output": { |
| 959 | + "type": "rich_text", |
| 960 | + "elements": [ |
| 961 | + { |
| 962 | + "type": "rich_text_section", |
| 963 | + "elements": [{"type": "text", "text": "Found weather data for Chicago from 2 sources"}], |
| 964 | + } |
| 965 | + ], |
| 966 | + }, |
| 967 | + "sources": [ |
| 968 | + {"type": "url", "url": "https://weather.com/", "text": "weather.com"}, |
| 969 | + {"type": "url", "url": "https://www.accuweather.com/", "text": "accuweather.com"}, |
| 970 | + ], |
| 971 | + } |
| 972 | + self.assertDictEqual(input, TaskCardBlock(**input).to_dict()) |
| 973 | + self.assertDictEqual(input, Block.parse(input).to_dict()) |
| 974 | + |
| 975 | + |
893 | 976 | # ---------------------------------------------- |
894 | 977 | # Video |
895 | 978 | # ---------------------------------------------- |
|
0 commit comments