Skip to content

Commit f95c926

Browse files
authoredSep 6, 2024··
Fix tests (#38)
Updated the column to which the null value is sent. The previous column isn't optional
1 parent 0db9914 commit f95c926

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎spra-play-server/src/test/scala/controllers/AdminControllerSpec.scala

+7-4
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {
670670
}
671671

672672
"don't fail if we send a null in an optional parameter" in withApiClient { client =>
673-
val json = """{"name":"wiringbits","email":null,"password":"wiringbits"}"""
673+
val json = """{"name":"wiringbits","last_name":null,"email":"test@wiringbits.net","password":"wiringbits"}"""
674674
val path = s"/admin/tables/${usersSettings.tableName}"
675675
val response = POST(path, json).futureValue
676676
response.header.status mustBe 200
@@ -679,6 +679,7 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {
679679
client.getTableMetadata(usersSettings.tableName, List("name", "ASC"), List(0, 9), "{}").futureValue
680680

681681
responseMetadata.head.nonEmpty mustBe true
682+
responseMetadata.head("last_name") mustBe ""
682683
}
683684

684685
"return new user id" in withApiClient { implicit client =>
@@ -802,23 +803,25 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {
802803

803804
"don't fail if we send a null in an optional parameter" in withApiClient { client =>
804805
val name = "wiringbits"
806+
val lastName = "test"
805807
val email = "test@wiringbits.net"
806808
val password = "wiringbits"
807-
val request = AdminCreateTable.Request(Map("name" -> name, "email" -> email, "password" -> password))
809+
val request =
810+
AdminCreateTable.Request(Map("name" -> name, "last_name" -> lastName, "email" -> email, "password" -> password))
808811
client.createItem("users", request).futureValue
809812
val responseMetadata1 =
810813
client.getTableMetadata(usersSettings.tableName, List("name", "ASC"), List(0, 9), "{}").futureValue
811814
val id = responseMetadata1.head("id")
812815

813-
val json = """{"email":null}"""
816+
val json = """{"last_name":"null"}"""
814817
val path = s"/admin/tables/${usersSettings.tableName}/$id"
815818
val response = PUT(path, json).futureValue
816819
response.header.status mustBe 200
817820

818821
val responseMetadata2 =
819822
client.getTableMetadata(usersSettings.tableName, List("name", "ASC"), List(0, 9), "{}").futureValue
820823

821-
responseMetadata2.head("email") mustBe ""
824+
responseMetadata2.head("last_name") mustBe ""
822825
}
823826

824827
"fail if the field in body doesn't exists" in withApiClient { client =>

0 commit comments

Comments
 (0)
Please sign in to comment.