1616@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/prepDefaultData.sql" )
1717@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/prepMapData.sql" )
1818public class MapPoolElideTest extends AbstractIntegrationTest {
19- private static final String NEW_LADDER_MAP_BODY = "{\" data\" :{\" type\" :\" mapVersion\" ,\" id\" :\" 2\" }} }" ;
19+ private static final String NEW_LADDER_MAP_BODY = "{\" data\" :[ {\" type\" :\" mapVersion\" ,\" id\" :\" 2\" }] }" ;
2020
2121 @ Test
2222 public void cannotCreateMapPoolItemWithoutScope () throws Exception {
2323 mockMvc .perform (
24- post ("/data/mapPool/1/mapVersions" )
24+ post ("/data/mapPool/1/relationships/ mapVersions" )
2525 .with (getOAuthTokenWithTestUser (NO_SCOPE , GroupPermission .ROLE_WRITE_MATCHMAKER_MAP ))
2626 .header (HttpHeaders .CONTENT_TYPE , JsonApiMediaType .JSON_API_MEDIA_TYPE )
2727 .content (NEW_LADDER_MAP_BODY )) // magic value from prepMapData.sql
@@ -31,7 +31,7 @@ public void cannotCreateMapPoolItemWithoutScope() throws Exception {
3131 @ Test
3232 public void cannotCreateMapPoolItemWithoutRole () throws Exception {
3333 mockMvc .perform (
34- post ("/data/mapPool/1/mapVersions" )
34+ post ("/data/mapPool/1/relationships/ mapVersions" )
3535 .with (getOAuthTokenWithTestUser (OAuthScope ._ADMINISTRATIVE_ACTION , NO_AUTHORITIES ))
3636 .header (HttpHeaders .CONTENT_TYPE , JsonApiMediaType .JSON_API_MEDIA_TYPE )
3737 .content (NEW_LADDER_MAP_BODY )) // magic value from prepMapData.sql
@@ -41,34 +41,37 @@ public void cannotCreateMapPoolItemWithoutRole() throws Exception {
4141 @ Test
4242 public void canCreateMapPoolItemWithScopeAndRole () throws Exception {
4343 mockMvc .perform (
44- post ("/data/mapPool/1/mapVersions" )
44+ post ("/data/mapPool/1/relationships/ mapVersions" )
4545 .with (getOAuthTokenWithTestUser (OAuthScope ._ADMINISTRATIVE_ACTION , GroupPermission .ROLE_WRITE_MATCHMAKER_MAP ))
4646 .header (HttpHeaders .CONTENT_TYPE , JsonApiMediaType .JSON_API_MEDIA_TYPE )
4747 .content (NEW_LADDER_MAP_BODY )) // magic value from prepMapData.sql
48- .andExpect (status ().isCreated ());
48+ .andExpect (status ().isNoContent ());
4949 }
5050
5151 @ Test
5252 public void canDeleteMapPoolItemWithScopeAndRole () throws Exception {
5353 mockMvc .perform (
54- delete ("/data/mapPool/1/mapVersions/1" )
55- .with (getOAuthTokenWithTestUser (OAuthScope ._ADMINISTRATIVE_ACTION , GroupPermission .ROLE_WRITE_MATCHMAKER_MAP ))) // magic value from prepMapData.sql
54+ delete ("/data/mapPool/1/relationships/mapVersions/1" )
55+ .with (getOAuthTokenWithTestUser (OAuthScope ._ADMINISTRATIVE_ACTION , GroupPermission .ROLE_WRITE_MATCHMAKER_MAP ))
56+ .content (NEW_LADDER_MAP_BODY )) // magic value from prepMapData.sql
5657 .andExpect (status ().isNoContent ());
5758 }
5859
5960 @ Test
6061 public void cannotDeleteMapPoolItemWithoutScope () throws Exception {
6162 mockMvc .perform (
62- delete ("/data/mapPool/1/mapVersions/1" )
63- .with (getOAuthTokenWithTestUser (NO_SCOPE , GroupPermission .ROLE_WRITE_MATCHMAKER_MAP ))) // magic value from prepMapData.sql
63+ delete ("/data/mapPool/1/relationships/mapVersions/1" )
64+ .with (getOAuthTokenWithTestUser (NO_SCOPE , GroupPermission .ROLE_WRITE_MATCHMAKER_MAP ))
65+ .content (NEW_LADDER_MAP_BODY )) // magic value from prepMapData.sql
6466 .andExpect (status ().isForbidden ());
6567 }
6668
6769 @ Test
6870 public void cannotDeleteMapPoolItemWithoutRole () throws Exception {
6971 mockMvc .perform (
7072 delete ("/data/mapPool/1" )
71- .with (getOAuthTokenWithTestUser (OAuthScope ._ADMINISTRATIVE_ACTION , NO_AUTHORITIES ))) // magic value from prepMapData.sql
73+ .with (getOAuthTokenWithTestUser (OAuthScope ._ADMINISTRATIVE_ACTION , NO_AUTHORITIES ))
74+ .content (NEW_LADDER_MAP_BODY )) // magic value from prepMapData.sql
7275 .andExpect (status ().isForbidden ());
7376 }
7477}
0 commit comments