From c12a994c76b202919fee5cad5ae91fe1a3dee42c Mon Sep 17 00:00:00 2001 From: steven choi Date: Wed, 11 Oct 2023 15:43:19 +1100 Subject: [PATCH] #728 write test case --- .../profile/hub/AdminControllerSpec.groovy | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/test/groovy/au/org/ala/profile/hub/AdminControllerSpec.groovy diff --git a/src/test/groovy/au/org/ala/profile/hub/AdminControllerSpec.groovy b/src/test/groovy/au/org/ala/profile/hub/AdminControllerSpec.groovy new file mode 100644 index 00000000..c23f9592 --- /dev/null +++ b/src/test/groovy/au/org/ala/profile/hub/AdminControllerSpec.groovy @@ -0,0 +1,31 @@ +package au.org.ala.profile.hub + +import grails.testing.web.controllers.ControllerUnitTest +import org.apache.http.HttpStatus +import spock.lang.Specification + +class AdminControllerSpec extends Specification implements ControllerUnitTest { + + AdminController mockAdminController + + def setup() { + mockAdminController = Mock(AdminController) + } + + def "cache management should display to the admin controller when admin mode"() { + when: + mockAdminController.cacheManagement() + + then: + assert response.status == HttpStatus.SC_OK + } + + def "clearCache() should return a 200 (OK_REQUEST) if id has been provided"() { + when: + params.id = "userDetailsCache" + mockAdminController.clearCache() + + then: + response.status == HttpStatus.SC_OK + } +}