-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tenant): Update partner synchronization endpoints to return revo…
…ked accesses if asked (#675)
- Loading branch information
1 parent
8d48441
commit 469f5e7
Showing
10 changed files
with
157 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...ant/src/test/java/fr/dossierfacile/api/front/dfc/controller/DfcTenantsControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package fr.dossierfacile.api.front.dfc.controller; | ||
|
||
import fr.dossierfacile.api.front.security.interfaces.ClientAuthenticationFacade; | ||
import fr.dossierfacile.api.front.service.interfaces.TenantService; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
import org.springframework.test.web.servlet.setup.MockMvcBuilders; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
class DfcTenantsControllerTest { | ||
|
||
private MockMvc mvc; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
var controller = new DfcTenantsController(mock(ClientAuthenticationFacade.class), mock(TenantService.class), null, null); | ||
mvc = MockMvcBuilders.standaloneSetup(controller).build(); | ||
} | ||
|
||
@Test | ||
void should_add_response_metadata() throws Exception { | ||
var request = get("/dfc/api/v1/tenants") | ||
.queryParam("after", "2020-01-31T10:30:00.000-05:00") | ||
.queryParam("limit", "10") | ||
.queryParam("includeDeleted", "true"); | ||
|
||
String contentAsString = mvc.perform(request) | ||
.andExpect(status().isOk()) | ||
.andReturn() | ||
.getResponse().getContentAsString(); | ||
|
||
assertThat(contentAsString).isEqualToIgnoringNewLines(""" | ||
{"data":[],"metadata":{"limit":10,"resultCount":0,"nextLink":"/dfc/api/v1/tenants?limit=10&after=2020-01-31T10:30&includeDeleted=true&includeRevoked=false"}}"""); | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
...st/java/fr/dossierfacile/api/front/partner/controller/ApiPartnerTenantControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package fr.dossierfacile.api.front.partner.controller; | ||
|
||
import fr.dossierfacile.api.front.security.interfaces.ClientAuthenticationFacade; | ||
import fr.dossierfacile.api.front.service.interfaces.TenantService; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; | ||
import org.springframework.test.web.servlet.setup.MockMvcBuilders; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
class ApiPartnerTenantControllerTest { | ||
|
||
private MockMvc mvc; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
var controller = new ApiPartnerTenantController(mock(ClientAuthenticationFacade.class), mock(TenantService.class), null, null); | ||
mvc = MockMvcBuilders.standaloneSetup(controller).build(); | ||
} | ||
|
||
@Test | ||
void should_add_response_metadata() throws Exception { | ||
var request = get("/api-partner/tenant") | ||
.queryParam("after", "2020-01-31T10:30:00.000-05:00") | ||
.queryParam("limit", "10") | ||
.queryParam("includeDeleted", "true"); | ||
|
||
String contentAsString = mvc.perform(request) | ||
.andExpect(status().isOk()) | ||
.andReturn() | ||
.getResponse().getContentAsString(); | ||
|
||
assertThat(contentAsString).isEqualToIgnoringNewLines(""" | ||
{"data":[],"metadata":{"limit":10,"resultCount":0,"nextLink":"/api-partner/tenant?limit=10&orderBy=LAST_UPDATE_DATE&after=2020-01-31T10:30&includeDeleted=true&includeRevoked=false"}}"""); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters