Skip to content

Commit

Permalink
Test Refactor (IdentityZoneResolvingMockMvcTest)
Browse files Browse the repository at this point in the history
- Apply IntelliJ sanitizations

[#163234874] https://www.pivotaltracker.com/story/show/163234874
  • Loading branch information
joshuatcasey committed Jan 15, 2019
1 parent dc8f89e commit e4333e0
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,25 @@
public class IdentityZoneResolvingMockMvcTest extends InjectedMockContextTest {

private Set<String> originalHostnames;

@Before
public void storeSettings() throws Exception {
public void storeSettings() {
originalHostnames = getWebApplicationContext().getBean(IdentityZoneResolvingFilter.class).getDefaultZoneHostnames();
}

@After
public void restoreSettings() throws Exception {
public void restoreSettings() {
getWebApplicationContext().getBean(IdentityZoneResolvingFilter.class).restoreDefaultHostnames(originalHostnames);
}

@Test
public void testSwitchingZones() throws Exception {
// Authenticate with new Client in new Zone
getMockMvc().perform(
get("/login")
.header("Host", "testsomeother.ip.com")
get("/login")
.header("Host", "testsomeother.ip.com")
)
.andExpect(status().isOk());
.andExpect(status().isOk());
}

@Test
Expand All @@ -56,23 +57,22 @@ public void testSwitchingZones_When_HostsConfigured() throws Exception {
getWebApplicationContext().getBean(IdentityZoneResolvingFilter.class).setDefaultInternalHostnames(hosts);
// Authenticate with new Client in new Zone
getMockMvc().perform(
get("/login")
.header("Host", "testsomeother.ip.com")
get("/login")
.header("Host", "testsomeother.ip.com")
)
.andExpect(status().isOk());
.andExpect(status().isOk());
getMockMvc().perform(
get("/login")
.header("Host", "localhost")
get("/login")
.header("Host", "localhost")
)
.andExpect(status().isOk());
.andExpect(status().isOk());

getMockMvc().perform(
get("/login")
.header("Host", "testsomeother2.ip.com")
get("/login")
.header("Host", "testsomeother2.ip.com")
)
.andExpect(status().isNotFound());
.andExpect(status().isNotFound());
}



}

0 comments on commit e4333e0

Please sign in to comment.