Я создал простое приложение Grails (https://github.com/spierepf/demo) с одним интеграционным тестом:
void "test something"() {
given:"a user account is created and given a registration code"
def user = new User(username:"username", password:"password", accountLocked:true, accountExpired:false, enabled:true).save()
def registrationCode = new RegistrationCode(username:user.username).save()
when:"that user engages the verify registration action with their registration code's token"
RestResponse resp = rest.get("http://localhost:${serverPort}/verifyRegistration?t=${registrationCode.token}")
then:"that user account should be unlocked, not expired, and enabled"
resp.status == 200
def updatedUser = User.findByUsername(user.username)
updatedUser.accountLocked == false
updatedUser.accountExpired == false
updatedUser.enabled == true
}
Я ожидаю, что тест создаст новый «заблокированный» объект пользователя ссвязанный объект RegistrationCode.
После этого приложение отправит электронное письмо, содержащее ссылку verifyRegistration, ссылающуюся на токен RegistrationCode. Тест запускает эту ссылку, которая, как я ожидаю, должна привести к тому, что объект User станет «разблокированным».этого не происходит.