|
10 | 10 | import com.slack.api.bolt.request.builtin.EventRequest; |
11 | 11 | import com.slack.api.bolt.request.builtin.SSLCheckRequest; |
12 | 12 | import com.slack.api.bolt.response.Response; |
| 13 | +import com.slack.api.methods.response.auth.AuthTestResponse; |
13 | 14 | import com.slack.api.model.event.ReactionAddedEvent; |
14 | 15 | import lombok.extern.slf4j.Slf4j; |
15 | 16 | import org.junit.After; |
|
24 | 25 | import java.util.Map; |
25 | 26 | import java.util.concurrent.atomic.AtomicBoolean; |
26 | 27 |
|
| 28 | +import static org.hamcrest.CoreMatchers.is; |
| 29 | +import static org.hamcrest.CoreMatchers.nullValue; |
| 30 | +import static org.hamcrest.MatcherAssert.assertThat; |
27 | 31 | import static org.junit.Assert.*; |
28 | 32 |
|
29 | 33 | @Slf4j |
@@ -211,4 +215,32 @@ public void unmatchedHandler() throws Exception { |
211 | 215 | assertEquals(400L, response.getStatusCode().longValue()); |
212 | 216 | } |
213 | 217 |
|
| 218 | + @Test |
| 219 | + public void singleTeamBotTokenClient() throws Exception { |
| 220 | + App app = new App(AppConfig.builder() |
| 221 | + .signingSecret(secret) |
| 222 | + .singleTeamBotToken(AuthTestMockServer.ValidToken) |
| 223 | + .slack(slack) |
| 224 | + .build()); |
| 225 | + |
| 226 | + AuthTestResponse authTest = app.client().authTest(r -> r); |
| 227 | + assertThat(authTest.getError(), is(nullValue())); |
| 228 | + } |
| 229 | + |
| 230 | + @Test |
| 231 | + public void authorizeClient() throws Exception { |
| 232 | + App app = new App(AppConfig.builder() |
| 233 | + .signingSecret(secret) |
| 234 | + .clientId("111.222") |
| 235 | + .clientSecret("secret") |
| 236 | + .slack(slack) |
| 237 | + .build()); |
| 238 | + |
| 239 | + AuthTestResponse authTest = app.client().authTest(r -> r); |
| 240 | + assertThat(authTest.getError(), is("invalid_auth_local")); |
| 241 | + |
| 242 | + authTest = app.client().authTest(r -> r.token(AuthTestMockServer.ValidToken)); |
| 243 | + assertThat(authTest.getError(), is(nullValue())); |
| 244 | + } |
| 245 | + |
214 | 246 | } |
0 commit comments