-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding a test for the PreAuthenticationAutoConfigurationTest class
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...rg/georchestra/gateway/autoconfigure/security/PreAuthenticationAutoConfigurationTest.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,29 @@ | ||
package org.georchestra.gateway.autoconfigure.security; | ||
|
||
import org.georchestra.gateway.security.preauth.ResolveHttpHeadersGeorchestraUserFilter; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.AutoConfigurations; | ||
import org.springframework.boot.test.context.runner.ApplicationContextRunner; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class PreAuthenticationAutoConfigurationTest { | ||
private ApplicationContextRunner runner = new ApplicationContextRunner() | ||
.withConfiguration(AutoConfigurations.of(PreAuthenticationAutoConfiguration.class)); | ||
|
||
public @Test void resolveHttpHeadersGeorchestraUserFilterIsAvailable() { | ||
runner.withPropertyValues(""// | ||
, "georchestra.gateway.headerAuthentication: true" // | ||
).run(context -> { | ||
assertThat(context).hasNotFailed().hasSingleBean(ResolveHttpHeadersGeorchestraUserFilter.class); | ||
}); | ||
} | ||
|
||
public @Test void resolveHttpHeadersGeorchestraUserFilterIsUnavailable() { | ||
runner.withPropertyValues(""// | ||
, "georchestra.gateway.headerAuthentication: false" // | ||
).run(context -> { | ||
assertThat(context).hasNotFailed().doesNotHaveBean(ResolveHttpHeadersGeorchestraUserFilter.class); | ||
}); | ||
} | ||
} |