Skip to content

Commit 786f660

Browse files
committed
Update cards and attachment actions tests
1 parent 7e4fa88 commit 786f660

File tree

5 files changed

+250
-186
lines changed

5 files changed

+250
-186
lines changed

tests/api/adaptive_card.json

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"$schema": "https://adaptivecards.io/schemas/1.1.0/adaptive-card.json",
3+
"type": "AdaptiveCard",
4+
"version": "1.1",
5+
"body": [
6+
{
7+
"type": "Container",
8+
"items": [
9+
{
10+
"type": "TextBlock",
11+
"text": "Publish Adaptive Card schema",
12+
"weight": "bolder",
13+
"size": "medium"
14+
},
15+
{
16+
"type": "ColumnSet",
17+
"columns": [
18+
{
19+
"type": "Column",
20+
"width": "auto",
21+
"items": [
22+
{
23+
"type": "Image",
24+
"url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
25+
"size": "small",
26+
"style": "person"
27+
}
28+
]
29+
},
30+
{
31+
"type": "Column",
32+
"width": "stretch",
33+
"items": [
34+
{
35+
"type": "TextBlock",
36+
"text": "Matt Hidinger",
37+
"weight": "bolder",
38+
"wrap": true
39+
},
40+
{
41+
"type": "TextBlock",
42+
"spacing": "none",
43+
"text": "Created {{DATE(2017-02-14T06:08:39Z, SHORT)}}",
44+
"isSubtle": true,
45+
"wrap": true
46+
}
47+
]
48+
}
49+
]
50+
}
51+
]
52+
},
53+
{
54+
"type": "Container",
55+
"items": [
56+
{
57+
"type": "TextBlock",
58+
"text": "Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.",
59+
"wrap": true
60+
},
61+
{
62+
"type": "FactSet",
63+
"facts": [
64+
{
65+
"title": "Board:",
66+
"value": "Adaptive Card"
67+
},
68+
{
69+
"title": "List:",
70+
"value": "Backlog"
71+
},
72+
{
73+
"title": "Assigned to:",
74+
"value": "Matt Hidinger"
75+
},
76+
{
77+
"title": "Due date:",
78+
"value": "Not set"
79+
}
80+
]
81+
}
82+
]
83+
}
84+
],
85+
"actions": [
86+
{
87+
"type": "Action.ShowCard",
88+
"title": "Comment",
89+
"card": {
90+
"type": "AdaptiveCard",
91+
"body": [
92+
{
93+
"type": "Input.Text",
94+
"id": "comment",
95+
"isMultiline": true,
96+
"placeholder": "Enter your comment"
97+
}
98+
],
99+
"actions": [
100+
{
101+
"type": "Action.Submit",
102+
"title": "OK"
103+
}
104+
]
105+
}
106+
},
107+
{
108+
"type": "Action.OpenUrl",
109+
"title": "View",
110+
"url": "https://adaptivecards.io"
111+
}
112+
]
113+
}
Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
11
{
2-
"contentType": "application/vnd.microsoft.card.adaptive",
3-
"content": {
4-
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
5-
"type": "AdaptiveCard",
6-
"version": "1.0",
7-
"body": [
8-
{
9-
"type": "ColumnSet",
10-
"columns": [
11-
{
12-
"type": "Column",
13-
"width": 2,
14-
"items": [
15-
{
16-
"type": "TextBlock",
17-
"text": "Tell us about your problem",
18-
"weight": "bolder",
19-
"size": "medium"
20-
},
21-
{
22-
"type": "TextBlock",
23-
"text": "Your name",
24-
"wrap": true
25-
},
26-
{
27-
"type": "Input.Text",
28-
"id": "Name",
29-
"placeholder": "John Andersen"
30-
},
31-
{
32-
"type": "TextBlock",
33-
"text": "Your email",
34-
"wrap": true
35-
},
36-
{
37-
"type": "Input.Text",
38-
"id": "Email",
39-
"placeholder": "john.andersen@example.com",
40-
"style": "email"
41-
}
42-
]
43-
}
44-
]
45-
}
46-
],
47-
"actions": [
48-
{
49-
"type": "Action.Submit",
50-
"title": "Submit"
51-
}
52-
]
53-
}
2+
"$schema": "https://adaptivecards.io/schemas/1.1.0/adaptive-card.json",
3+
"type": "AdaptiveCard",
4+
"version": "1.1",
5+
"body": [
6+
{
7+
"type": "ColumnSet",
8+
"columns": [
9+
{
10+
"type": "Column",
11+
"width": 2,
12+
"items": [
13+
{
14+
"type": "TextBlock",
15+
"text": "Tell us about your problem",
16+
"weight": "bolder",
17+
"size": "medium"
18+
},
19+
{
20+
"type": "TextBlock",
21+
"text": "Your name",
22+
"wrap": true
23+
},
24+
{
25+
"type": "Input.Text",
26+
"id": "Name",
27+
"placeholder": "John Andersen"
28+
},
29+
{
30+
"type": "TextBlock",
31+
"text": "Your email",
32+
"wrap": true
33+
},
34+
{
35+
"type": "Input.Text",
36+
"id": "Email",
37+
"placeholder": "john.andersen@example.com",
38+
"style": "email"
39+
}
40+
]
41+
}
42+
]
43+
}
44+
],
45+
"actions": [
46+
{
47+
"type": "Action.Submit",
48+
"title": "Submit"
49+
}
50+
]
5451
}

tests/api/example_card.json

Lines changed: 0 additions & 109 deletions
This file was deleted.

tests/api/test_attachment_actions.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,20 @@ def attachment_action_create(api, test_people, attachment_actions_card):
5757
message = api.messages.create(
5858
toPersonEmail=person.emails[0],
5959
text=create_string("Message"),
60-
attachments=[attachment_actions_card],
60+
attachments=[
61+
{
62+
"contentType": "application/vnd.microsoft.card.adaptive",
63+
"content": attachment_actions_card,
64+
}
65+
],
6166
)
6267
attachment_action = api.attachment_actions.create(
63-
type="submit", messageId=message.id,
64-
inputs={"Name": person.displayName, "Email": person.emails[0]}
68+
type="submit",
69+
messageId=message.id,
70+
inputs={
71+
"Name": person.displayName,
72+
"Email": person.emails[0],
73+
}
6574
)
6675

6776
yield attachment_action

0 commit comments

Comments
 (0)