Update to accept count filter as POST

This commit is contained in:
2022-10-14 10:19:21 -05:00
parent 117bb621ff
commit 37fbfd1c7c
2 changed files with 47 additions and 0 deletions

View File

@ -239,6 +239,48 @@ class QJavalinImplementationTest extends QJavalinTestBase
/*******************************************************************************
** test a table count with a filter.
**
*******************************************************************************/
@Test
public void test_dataCountWithFilter()
{
String filterJson = getFirstNameEqualsTimFilterJSON();
HttpResponse<String> response = Unirest.get(BASE_URL + "/data/person/count?filter=" + URLEncoder.encode(filterJson, StandardCharsets.UTF_8)).asString();
assertEquals(200, response.getStatus());
JSONObject jsonObject = JsonUtils.toJSONObject(response.getBody());
assertTrue(jsonObject.has("count"));
int count = jsonObject.getInt("count");
assertEquals(1, count);
}
/*******************************************************************************
** test a table count POST.
**
*******************************************************************************/
@Test
public void test_dataCountPOST()
{
String filterJson = getFirstNameEqualsTimFilterJSON();
HttpResponse<String> response = Unirest.post(BASE_URL + "/data/person/count")
.field("filter", filterJson)
.asString();
assertEquals(200, response.getStatus());
JSONObject jsonObject = JsonUtils.toJSONObject(response.getBody());
assertTrue(jsonObject.has("count"));
int count = jsonObject.getInt("count");
assertEquals(1, count);
}
/*******************************************************************************
** test a table query
**