Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Commit

Permalink
lmao
Browse files Browse the repository at this point in the history
  • Loading branch information
LolWastedJS committed Oct 27, 2020
1 parent a308f4a commit 0b2d032
Showing 1 changed file with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,33 @@
@ActiveProfiles({"test"})
public class RequestAuthorizationFilterTest {

@Autowired
protected MockMvc mvc;

@Autowired
protected ServerConfig serverConfig;

@Autowired
protected AppInfo appInfo;

@Test
public void unauthenticatedRequest_Fail() throws Exception {
this.mvc.perform(get("/loadtracks"))
.andExpect(status().isUnauthorized());
}

@Test
public void wrongAuthenticatedRequest_Fail() throws Exception {
this.mvc.perform(get("/loadtracks")
.header("Authorization", serverConfig.getPassword() + "foo"))
.andExpect(status().isForbidden());
}

@Test
public void authenticatedRequest_Success() throws Exception {
this.mvc.perform(get("/version")
.header("Authorization", serverConfig.getPassword()))
.andExpect(status().isOk())
.andExpect(content().string(appInfo.getVersionBuild()));
}
@Autowired
protected MockMvc mvc;

@Autowired
protected ServerConfig serverConfig;

@Autowired
protected AppInfo appInfo;

@Test
public void unauthenticatedRequest_Fail() throws Exception {
this.mvc.perform(get("/loadtracks"))
.andExpect(status().isUnauthorized());
}

@Test
public void wrongAuthenticatedRequest_Fail() throws Exception {
this.mvc.perform(get("/loadtracks")
.header("Authorization", serverConfig.getPassword() + "foo"))
.andExpect(status().isForbidden());
}

@Test
public void authenticatedRequest_Success() throws Exception {
this.mvc.perform(get("/version")
.header("Authorization", serverConfig.getPassword()))
.andExpect(status().isOk())
.andExpect(content().string(appInfo.getVersionBuild()));
}
}

0 comments on commit 0b2d032

Please sign in to comment.