Skip to content

Commit

Permalink
#728 write test case
Browse files Browse the repository at this point in the history
  • Loading branch information
schoicsiro committed Oct 11, 2023
1 parent a5cfb6e commit c12a994
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/test/groovy/au/org/ala/profile/hub/AdminControllerSpec.groovy
Original file line number Diff line number Diff line change
@@ -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> {

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
}
}

0 comments on commit c12a994

Please sign in to comment.