-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #41 migrate all integration test (or delete useless ones)
- Loading branch information
1 parent
0128cb1
commit 45cca38
Showing
19 changed files
with
69 additions
and
557 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/inttest/java/com/faforever/api/data/AvatarElideTest.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,52 @@ | ||
package com.faforever.api.data; | ||
|
||
import com.faforever.api.AbstractIntegrationTest; | ||
import com.faforever.api.avatar.AvatarRepository; | ||
import com.faforever.api.data.domain.Avatar; | ||
import org.junit.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.context.jdbc.Sql; | ||
import org.springframework.test.context.jdbc.Sql.ExecutionPhase; | ||
import org.springframework.test.web.servlet.MvcResult; | ||
|
||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
@Sql(executionPhase = ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:sql/prepDefaultUser.sql") | ||
@Sql(executionPhase = ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:sql/prepAvatarData.sql") | ||
@Sql(executionPhase = ExecutionPhase.AFTER_TEST_METHOD, scripts = "classpath:sql/cleanAvatarData.sql") | ||
public class AvatarElideTest extends AbstractIntegrationTest { | ||
@Autowired | ||
AvatarRepository avatarRepository; | ||
|
||
@Test | ||
public void getUnusedAvatar() throws Exception { | ||
Avatar avatar = avatarRepository.findOne(1); | ||
|
||
MvcResult result = mockMvc.perform(get("/data/avatar/1")) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.data.id", is(String.valueOf(avatar.getId())))) | ||
.andExpect(jsonPath("$.data.type", is("avatar"))) | ||
.andExpect(jsonPath("$.data.attributes.tooltip", is(avatar.getTooltip()))) | ||
.andExpect(jsonPath("$.data.attributes.url", is(avatar.getUrl()))) | ||
.andExpect(jsonPath("$.data.relationships.assignments.data", hasSize(0))) | ||
.andReturn(); | ||
} | ||
|
||
@Test | ||
public void getAvatarWithPlayer() throws Exception { | ||
Avatar avatar = avatarRepository.findOne(2); | ||
|
||
MvcResult result = mockMvc.perform(get("/data/avatar/2")) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.data.id", is(String.valueOf(avatar.getId())))) | ||
.andExpect(jsonPath("$.data.type", is("avatar"))) | ||
.andExpect(jsonPath("$.data.attributes.tooltip", is(avatar.getTooltip()))) | ||
.andExpect(jsonPath("$.data.attributes.url", is(avatar.getUrl()))) | ||
.andExpect(jsonPath("$.data.relationships.assignments.data", hasSize(2))) | ||
.andReturn(); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...com/faforever/api/clan/ClanElideTest.java → ...com/faforever/api/data/ClanElideTest.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
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,3 @@ | ||
DELETE FROM avatars; | ||
DELETE FROM avatars_list; | ||
|
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
DELETE FROM avatars; | ||
DELETE FROM avatars_list; | ||
|
||
INSERT INTO avatars_list (id, url, tooltip) VALUES | ||
(1, 'http://localhost/avatar1.png', 'Avatar No. 1'), | ||
(2, 'http://localhost/avatar2.png', 'Avatar No. 2'); | ||
|
||
INSERT INTO avatars (id, idUser, idAvatar, selected) VALUES | ||
(1, 1, 2, 1), | ||
(2, 2, 2, 0); |
16 changes: 0 additions & 16 deletions
16
src/test/java/com/faforever/api/FafJavaApiApplicationTests.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...er/integration/factories/ClanFactory.java → ...a/com/faforever/api/clan/ClanFactory.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
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
102 changes: 0 additions & 102 deletions
102
src/test/java/com/faforever/api/data/JsonApiAvatarIntegrationTest.java
This file was deleted.
Oops, something went wrong.
75 changes: 0 additions & 75 deletions
75
src/test/java/com/faforever/api/data/JsonApiBanIntegrationTest.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/test/java/com/faforever/api/data/listeners/ClanEnricherListenerTest.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
Oops, something went wrong.