Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
federicaagostini committed Jul 31, 2024
1 parent c209189 commit 2439b90
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.openid.connect.web.ApprovedSiteAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
Expand Down Expand Up @@ -382,6 +383,16 @@ public void testDeviceCodeApprovalFlowWorks() throws Exception {
.getRequest()
.getSession();

String APPROVED_SITE_URL = "http://localhost:8080/" + ApprovedSiteAPI.URL;

session = (MockHttpSession) mvc.perform(get(APPROVED_SITE_URL).session(session))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].clientId", equalTo(DEVICE_CODE_CLIENT_ID)))
.andExpect(jsonPath("$[0].userId", equalTo(TEST_USERNAME)))
.andReturn()
.getRequest()
.getSession();


String tokenResponse = mvc
.perform(
Expand Down

0 comments on commit 2439b90

Please sign in to comment.