Give the tests more descriptive names

This commit is contained in:
ProtoByter 2022-12-07 08:24:08 +00:00
parent b452626fe9
commit b163d04926
2 changed files with 18 additions and 18 deletions

View File

@ -41,7 +41,7 @@ internal class DatabaseHandlerTest {
}
@Test
fun testAddClient() {
fun `addClient() test`() {
DatabaseHandler.addClient(UUID.fromString("00000000-0000-0000-0000-000000000010"), "AddTestClient1", "0.0.0.0:1", sampledClientsTestVal)
DatabaseHandler.getClient("AddTestClient1")?.let {
assert(it.name == "AddTestClient1")
@ -52,7 +52,7 @@ internal class DatabaseHandlerTest {
}
@Test
fun testGetClient() {
fun `getClient() test`() {
DatabaseHandler.getClient("TestClient1")?.let {
assert(it.name == "TestClient1")
assert(it.ip == "0.0.0.0:1")
@ -76,7 +76,7 @@ internal class DatabaseHandlerTest {
}
@Test
fun testRemoveClient() {
fun `removeClient() test`() {
DatabaseHandler.removeClient(UUID.fromString("00000000-0000-0000-0000-000000000001"))
assert(DatabaseHandler.getClient("TestClient1") == null)
@ -88,7 +88,7 @@ internal class DatabaseHandlerTest {
}
@Test
fun testCheckAuth() {
fun `checkCredentials() test`() {
DatabaseHandler.getClient("TestClient1")?.let {
assert(DatabaseHandler.checkCredentials(it.uuid, it.passwordHash))
}
@ -103,7 +103,7 @@ internal class DatabaseHandlerTest {
}
@Test
fun testHeartbeatHashes() {
fun `test heartbeat logic hashing`() {
val sha3 = SHA3.getSha3_512()
val clients = listOf("TestClient1", "TestClient2", "TestClient3")
@ -118,7 +118,7 @@ internal class DatabaseHandlerTest {
}
@Test
fun testHeartbeatTimes() {
fun `test heartbeat logic time updates`() {
val clients = listOf("TestClient1", "TestClient2", "TestClient3")
for (client in clients) {

View File

@ -21,7 +21,7 @@ class TrackerApplicationKtTest {
}
@Test
fun testPostExitInvalidID() = testApplication {
fun `post to the exit endpoint with invalid UUID`() = testApplication {
val client = createClient {
install(ContentNegotiation) {
json()
@ -39,7 +39,7 @@ class TrackerApplicationKtTest {
}
@Test
fun testPostExitInvalidPw() = testApplication {
fun `post to the exit endpoint with an invalid password`() = testApplication {
val client = createClient {
install(ContentNegotiation) {
json()
@ -57,7 +57,7 @@ class TrackerApplicationKtTest {
@Test
fun testPostExitValidID() = testApplication {
fun `post to the exit endpoint with a valid ID and Password`() = testApplication {
val client = createClient {
install(ContentNegotiation) {
json()
@ -76,21 +76,21 @@ class TrackerApplicationKtTest {
}
@Test
fun testPostExitNoBody() = testApplication {
fun `post to the exit endpoint with no body`() = testApplication {
client.post("/protected/exit").apply {
assertEquals(401, this.status.value)
}
}
@Test
fun testHeartbeatRequestNoBody() = testApplication {
fun `post to the heartbeat endpoint with no body`() = testApplication {
client.post("/protected/heartbeat").apply {
assertEquals(401, this.status.value)
}
}
@Test
fun testHeartbeatRequestCorrectBody() = testApplication {
fun `post to the heartbeat endpoint with the correct body`() = testApplication {
val client = createClient {
install(ContentNegotiation) {
json()
@ -110,7 +110,7 @@ class TrackerApplicationKtTest {
}
@Test
fun testHeartbeatRequestInvalidPassword() = testApplication {
fun `post to the heartbeat endpoint with an incorrect password`() = testApplication {
val client = createClient {
install(ContentNegotiation) {
json()
@ -127,14 +127,14 @@ class TrackerApplicationKtTest {
}
@Test
fun testRegisterRequestNoBody() = testApplication {
fun `post to the register endpoint with no body`() = testApplication {
client.post("/register").apply {
assertEquals(400, this.status.value)
}
}
@Test
fun testRegisterRequestCorrectBody() = testApplication {
fun `post to the register endpoint with correct parameters`() = testApplication {
val client = createClient {
install(ContentNegotiation) {
json()
@ -159,7 +159,7 @@ class TrackerApplicationKtTest {
}
@Test
fun testRegisterRequestInvalidAPIVersion() = testApplication {
fun `post to the register endpoint with an incorrect API version`() = testApplication {
val client = createClient {
install(ContentNegotiation) {
json()
@ -184,7 +184,7 @@ class TrackerApplicationKtTest {
}
@Test
fun testSearchRequestNoBody() = testApplication {
fun `get to the search endpoint with no body`() = testApplication {
client.get("/protected/search").apply {
assertEquals(401, this.status.value)
@ -192,7 +192,7 @@ class TrackerApplicationKtTest {
}
@Test
fun testSearchRequestCorrectBodyNoPort() = testApplication {
fun `get to the search endpoint with correct parameters, but on a client whose port is unknown`() = testApplication {
val client = createClient {
install(ContentNegotiation) {
json()