I am using spock for may application testing and using Grails 2.4.4. I have done domain, controller, and service unit testing. But in controller sections I am stuck with the role wise access. For authentication I am using Spring Security Core Plugin. Below are my sample code.
@Secured(["IS_AUTHENTICATED_FULLY"])
def index(Integer max) {
}
@Secured(["ROLE_A","ROLE_B"])
def create() {
respond new DomainName(params)
}
@Transactional
@Secured(["ROLE_A","ROLE_B"])
def save(DomainName DomainNameInstance) {
}
How do I test that only the user with ROLE_A and ROLE_B can create and save and other cannot? Also I do I check the user is IS_AUTHENTICATED_FULLY to access index action ?
Aucun commentaire:
Enregistrer un commentaire