Skip to content

Fix tests #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {
}

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

responseMetadata.head.nonEmpty mustBe true
responseMetadata.head("last_name") mustBe ""
}

"return new user id" in withApiClient { implicit client =>
val user = createUser.futureValue
val response = client.getTableMetadata(usersSettings.tableName, List("name", "ASC"), List(0, 9), "{}").futureValue
Expand Down Expand Up @@ -802,23 +803,25 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {

"don't fail if we send a null in an optional parameter" in withApiClient { client =>
val name = "wiringbits"
val lastName = "test"
val email = "test@wiringbits.net"
val password = "wiringbits"
val request = AdminCreateTable.Request(Map("name" -> name, "email" -> email, "password" -> password))
val request =
AdminCreateTable.Request(Map("name" -> name, "last_name" -> lastName, "email" -> email, "password" -> password))
client.createItem("users", request).futureValue
val responseMetadata1 =
client.getTableMetadata(usersSettings.tableName, List("name", "ASC"), List(0, 9), "{}").futureValue
val id = responseMetadata1.head("id")

val json = """{"email":null}"""
val json = """{"last_name":"null"}"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a ticket, we need to find a way to deal with proper null values instead of the string "null"

val path = s"/admin/tables/${usersSettings.tableName}/$id"
val response = PUT(path, json).futureValue
response.header.status mustBe 200

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

responseMetadata2.head("email") mustBe ""
responseMetadata2.head("last_name") mustBe ""
}

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