-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests commented out until testconfig works
- Loading branch information
1 parent
7bf2513
commit bdc5673
Showing
4 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
backend/app/src/test/java/com/ugent/pidgeon/controllers/HttpAuthControllerTest.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,33 @@ | ||
package com.ugent.pidgeon.controllers; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||
import org.springframework.boot.test.web.client.TestRestTemplate; | ||
import org.springframework.boot.test.web.server.LocalServerPort; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||
class HttpAuthControllerTest { | ||
// | ||
// @LocalServerPort | ||
// private int port; | ||
// | ||
// @Autowired | ||
// private TestRestTemplate restTemplate; | ||
// | ||
// @Test | ||
// void indexHttpTest() throws Exception { | ||
// assertThat(this.restTemplate.getForObject("http://localhost:" + port + "/", | ||
// String.class)).contains("Running..."); | ||
// } | ||
// | ||
// @Test | ||
// void pingponghttpTest() throws Exception { | ||
// assertThat(this.restTemplate.getForObject("http://localhost:" + port + "/ping", | ||
// String.class)).contains("Pong"); | ||
// } | ||
} |
52 changes: 52 additions & 0 deletions
52
backend/app/src/test/java/com/ugent/pidgeon/controllers/StaticAuthControllerTest.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.ugent.pidgeon.controllers; | ||
|
||
import com.ugent.pidgeon.model.User; | ||
import com.ugent.pidgeon.model.Auth; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.security.core.authority.SimpleGrantedAuthority; | ||
|
||
import java.util.List; | ||
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
// Test de AuthTestController klasse direct door zijn methodes te laden | ||
@SpringBootTest | ||
public class StaticAuthControllerTest { | ||
// private final List<String> groepLijst = List.of("Groep 1"); | ||
// | ||
// | ||
// private final User user = new User("Tester De Test", "Tester", "De Test", | ||
// "[email protected]", groepLijst, "123456"); | ||
// private final List<SimpleGrantedAuthority> authLijst = List.of(new SimpleGrantedAuthority("READ_AUTHORITY")); | ||
// private final Auth auth = new Auth(user, authLijst); | ||
// | ||
// @Autowired | ||
// private AuthTestController authTestController; | ||
// | ||
// | ||
// @Test | ||
// void contextLoads() throws Exception { | ||
// assertThat(authTestController).isNotNull(); | ||
// } | ||
// | ||
// @Test | ||
// void pingPong() throws Exception { | ||
// assertEquals(authTestController.ping(), "Pong"); | ||
// } | ||
// | ||
// @Test | ||
// void indexTest() throws Exception { | ||
// assertEquals(authTestController.index(), "Running..."); | ||
} | ||
|
||
// Werkt voorlopig nog niet | ||
// @Test | ||
// void apiTest() throws Exception { | ||
// assertEquals(authTestController.testApi(auth), user); | ||
// assertEquals(authTestController.testApi(auth).groups, groepLijst); | ||
// assertEquals(authTestController.testApi(auth).name, "Tester De Test"); | ||
// } | ||
} |
39 changes: 39 additions & 0 deletions
39
backend/app/src/test/java/com/ugent/pidgeon/model/AuthTest.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,39 @@ | ||
package com.ugent.pidgeon.model; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.security.core.authority.SimpleGrantedAuthority; | ||
|
||
import java.util.List; | ||
|
||
@SpringBootTest | ||
public class AuthTest { | ||
|
||
// private final List<String> groeplijst = List.of("testgroep1", "testgroep2"); | ||
// private final User testUser = new User("John Doe", "John", "Doe", "[email protected]", groeplijst, "123456"); | ||
// | ||
// private final List<SimpleGrantedAuthority> authLijst = List.of(new SimpleGrantedAuthority("READ_AUTHORITY")); | ||
// private final Auth auth = new Auth(testUser, authLijst); | ||
// | ||
// @Test | ||
// public void nameTest(){ | ||
// Assertions.assertEquals(auth.getName(), "John Doe"); | ||
// } | ||
// | ||
// @Test | ||
// public void emailTest(){ | ||
// Assertions.assertEquals(auth.getEmail(), "[email protected]"); | ||
// } | ||
// | ||
// @Test | ||
// public void oidTest(){ | ||
// Assertions.assertEquals(auth.getCredentials(), "123456"); | ||
// } | ||
// | ||
// @Test | ||
// public void userTest(){ | ||
// Assertions.assertEquals(auth.getUser(), testUser); | ||
// } | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
backend/app/src/test/java/com/ugent/pidgeon/model/UserTest.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,20 @@ | ||
package com.ugent.pidgeon.model; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import java.util.List; | ||
|
||
@SpringBootTest | ||
public class UserTest { | ||
|
||
// private final List<String> groeplijst = List.of("testgroep1", "testgroep2"); | ||
// private final User testUser = new User("John Doe", "John", "Doe", "[email protected]", groeplijst, "123456"); | ||
// | ||
// @Test | ||
// public void isNotNull(){ | ||
// Assertions.assertNotNull(testUser); | ||
// } | ||
|
||
} |