forked from Onlineberatung/onlineBeratung-agencyService
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Onlineberatung#209 from Onlineberatung/TSYSTEMS-178
fix: pass cookie when calling tenantService to render privacy texts w…
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 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
33 changes: 33 additions & 0 deletions
33
.../de/caritas/cob/agencyservice/config/apiclient/TenantServiceApiControllerFactoryTest.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,33 @@ | ||
package de.caritas.cob.agencyservice.config.apiclient; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.mock.web.MockHttpServletRequest; | ||
import org.springframework.web.context.request.RequestContextHolder; | ||
import org.springframework.web.context.request.ServletRequestAttributes; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class TenantServiceApiControllerFactoryTest { | ||
|
||
@AfterEach | ||
void tearDown() { | ||
RequestContextHolder.resetRequestAttributes(); | ||
} | ||
|
||
@Test | ||
void createControllerApi_Should_CreateApiClientWithoutExceptions() { | ||
// given | ||
MockHttpServletRequest mockRequest = new MockHttpServletRequest(); | ||
mockRequest.addHeader("Authorization", "Bearer token"); | ||
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(mockRequest)); | ||
|
||
var tenantServiceApiControllerFactory = new TenantServiceApiControllerFactory(); | ||
|
||
// when | ||
var tenantControllerApi = tenantServiceApiControllerFactory.createControllerApi(); | ||
|
||
// then | ||
assertThat(tenantControllerApi).isNotNull(); | ||
} | ||
} |