Skip to content

Commit 39fb84a

Browse files
committed
Update tests not to depend on existing data (not perfect yet)
1 parent 1712133 commit 39fb84a

58 files changed

Lines changed: 1306 additions & 5053 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ node_modules/
1818
typescript-types/dist/
1919

2020
logs/
21-
json-logs/raw
21+
json-logs/raw*
2222

2323
.DS_Store
2424

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package samples;
2+
3+
import com.slack.api.SlackConfig;
4+
import com.slack.api.bolt.App;
5+
import com.slack.api.bolt.AppConfig;
6+
import com.slack.api.util.json.GsonFactory;
7+
import util.TestSlackAppServer;
8+
9+
import java.nio.file.Files;
10+
import java.nio.file.Paths;
11+
import java.util.stream.Collectors;
12+
13+
public class GridOrgAdminAppSample {
14+
15+
public static void main(String[] args) throws Exception {
16+
String jsonString = Files.readAllLines(Paths.get("bolt-servlet/src/test/resources/appConfig_org_admin_app.json"))
17+
.stream().collect(Collectors.joining("\n"));
18+
AppConfig appConfig = GsonFactory.createCamelCase(SlackConfig.DEFAULT).fromJson(jsonString, AppConfig.class);
19+
App app = new App(appConfig).asOAuthApp(true);
20+
TestSlackAppServer server = new TestSlackAppServer(app, "/slack/oauth/");
21+
server.start();
22+
}
23+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package test_with_remote_apis;
2+
3+
import com.slack.api.bolt.App;
4+
import com.slack.api.bolt.AppConfig;
5+
import com.slack.api.bolt.response.Response;
6+
import util.ResourceLoader;
7+
import util.TestSlackAppServer;
8+
9+
public class EventsApiApp {
10+
11+
public static void main(String[] args) throws Exception {
12+
AppConfig appConfig = ResourceLoader.loadAppConfig();
13+
App app = new App(appConfig);
14+
app.endpoint("/test", (req, ctx) -> Response.builder().body("Hi!").contentType("text/plain").build());
15+
TestSlackAppServer server = new TestSlackAppServer(app);
16+
server.start();
17+
}
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"clientId": "111.222",
3+
"clientSecret": "xxx",
4+
"signingSecret": "xxx",
5+
"oauthStartPath": "start",
6+
"oauthCallbackPath": "callback",
7+
"redirectUri": "https://your-subdomain.ngrok.io/slack/oauth/callback",
8+
"oauthCancellationUrl": "https://www.example.com/cancellation",
9+
"oauthCompletionUrl": "https://www.example.com/thank-you",
10+
"scope": "",
11+
"userScope": "admin,admin.conversations:read,admin.conversations:write,admin.invites:read,admin.invites:write,admin.teams:read,admin.teams:write,admin.usergroups:read,admin.usergroups:write,admin.users:read,admin.users:write,auditlogs:read,channels:read,usergroups:read,users:read",
12+
"installation_url_memo": "https://your-subdomain.ngrok.io/slack/oauth/start"
13+
}

json-logs/raw/audit/v1/actions.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"pref.mobile_secondary_auth_timeout_changed",
5252
"pref.dlp_access_changed",
5353
"pref.ent_required_browser",
54+
"pref.required_minimum_mobile_version_changed",
5455
"pref.enterprise_mobile_device_check",
5556
"pref.allow_calls",
5657
"pref.custom_tos",
@@ -85,8 +86,7 @@
8586
"pref.username_policy",
8687
"pref.enterprise_team_creation_request",
8788
"pref.loading_only_admins",
88-
"pref.display_real_names",
89-
"pref.required_minimum_mobile_version_changed"
89+
"pref.display_real_names"
9090
],
9191
"user": [
9292
"custom_tos_accepted",
@@ -147,8 +147,8 @@
147147
"external_shared_channel_disconnected",
148148
"external_shared_channel_reconnected",
149149
"channel_moved",
150-
"channel_renamed",
151-
"channel_posting_pref_changed_from_org_level"
150+
"channel_posting_pref_changed_from_org_level",
151+
"channel_renamed"
152152
],
153153
"app": [
154154
"app_installed",
@@ -163,17 +163,16 @@
163163
"bot_token_upgraded",
164164
"bot_token_downgraded"
165165
],
166-
"message": [
167-
"message_tombstoned",
168-
"message_restored"
169-
],
170166
"workflow_builder": [
171167
"workflow_created",
172168
"workflow_deleted",
173169
"workflow_published",
174170
"workflow_unpublished",
175-
"workflow_responses_csv_download",
176-
"workflow_unknown_action"
171+
"workflow_responses_csv_download"
172+
],
173+
"message": [
174+
"message_tombstoned",
175+
"message_restored"
177176
]
178177
}
179178
}

json-logs/raw/audit/v1/schemas.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@
5656
"scopes": "array"
5757
}
5858
},
59+
{
60+
"type": "workflow",
61+
"workflow": {
62+
"id": "string",
63+
"name": "string"
64+
}
65+
},
5966
{
6067
"type": "message",
6168
"message": {
6269
"team": "string",
6370
"channel": "string",
6471
"timestamp": "string"
6572
}
66-
},
67-
{
68-
"type": "workflow",
69-
"workflow": {
70-
"id": "string",
71-
"name": "string"
72-
}
7373
}
7474
]
7575
}

json-logs/samples/api/admin.conversations.setTeams.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
"ok": false,
33
"channel": "C00000000",
44
"error": "",
5-
"response_metadata": {
6-
"messages": [
7-
""
8-
]
9-
},
105
"needed": "",
116
"provided": ""
127
}

json-logs/samples/api/admin.usergroups.listChannels.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"ok": false,
3+
"error": "",
34
"channels": [
45
{
56
"id": "C00000000",
@@ -16,13 +17,11 @@
1617
"creator": "W00000000",
1718
"is_moved": 12345,
1819
"is_ext_shared": false,
20+
"enterprise_id": "E00000000",
21+
"is_global_shared": false,
22+
"is_org_default": false,
23+
"is_org_mandatory": false,
1924
"is_org_shared": false,
20-
"shared_team_ids": [
21-
"T00000000"
22-
],
23-
"internal_team_ids": [
24-
"T00000000"
25-
],
2625
"pending_shared": [
2726
""
2827
],
@@ -49,7 +48,6 @@
4948
"date_connected": 12345
5049
}
5150
],
52-
"error": "",
5351
"needed": "",
5452
"provided": ""
5553
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"ok": false,
3+
"error": "",
34
"args": {
4-
"foo": "",
5-
"error": ""
5+
"error": "",
6+
"foo": ""
67
},
7-
"error": "",
88
"needed": "",
99
"provided": ""
1010
}

0 commit comments

Comments
 (0)