Skip to content

Commit

Permalink
Add Mock response on old event when filtering by overdue
Browse files Browse the repository at this point in the history
Signed-off-by: andresmr <[email protected]>
  • Loading branch information
andresmr committed Jun 18, 2024
1 parent db377fc commit a2f0286
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class MockWebServerRobot(private val dhis2MockServer: Dhis2MockServer) {
const val API_OLD_TRACKED_ENTITY_PATH = "/api/trackedEntityInstances/query?.*"
const val API_OLD_TRACKED_ENTITY_RESPONSE =
"mocks/teilist/old_tracked_entity_empty_response.json"
const val API_OLD_EVENTS_PATH = "/api/events?.*"
const val API_OLD_EVENTS_RESPONSE = "mocks/teilist/old_events_empty_response.json"

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import dispatch.android.espresso.IdlingDispatcherProviderRule
import org.dhis2.R
import org.dhis2.bindings.app
import org.dhis2.common.idlingresources.MapIdlingResource
import org.dhis2.common.mockwebserver.MockWebServerRobot.Companion.API_OLD_EVENTS_PATH
import org.dhis2.common.mockwebserver.MockWebServerRobot.Companion.API_OLD_EVENTS_RESPONSE
import org.dhis2.common.mockwebserver.MockWebServerRobot.Companion.API_OLD_TRACKED_ENTITY_PATH
import org.dhis2.common.mockwebserver.MockWebServerRobot.Companion.API_OLD_TRACKED_ENTITY_RESPONSE
import org.dhis2.commons.date.DateUtils.SIMPLE_DATE_FORMAT
Expand Down Expand Up @@ -202,6 +204,16 @@ class SearchTETest : BaseTest() {

@Test
fun shouldSuccessfullyFilterByEventStatusOverdue() {
mockWebServerRobot.addResponse(
ResponseController.GET,
API_OLD_TRACKED_ENTITY_PATH,
API_OLD_TRACKED_ENTITY_RESPONSE,
)
mockWebServerRobot.addResponse(
ResponseController.GET,
API_OLD_EVENTS_PATH,
API_OLD_EVENTS_RESPONSE,
)
enableComposeForms()
val eventStatusFilter = context.getString(R.string.filters_title_event_status)
val totalCount = "1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"pager": {
"page": 1,
"pageCount": 1,
"total": 2,
"pageSize": 50
},
"events": []
}

0 comments on commit a2f0286

Please sign in to comment.