Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.0-RC3
-
Fix Version/s: None
-
Component/s: Controllers, Testing
-
Labels:None
-
Testcase included:yes
Description
In a controller I define a method that only accept http POST method.
When I want to test this behavior in a unit test, if I define a request using GET method, I have no error status in the response. Instead I get a 200.
I attach a simple project with a test doing test with both GET and POST method.
Issue Links
- is duplicated by
-
GRAILS-8434
Allowed methods are not respected in unit tests
-
- is related to
-
GRAILS-8382
Error with unit testing extended controllers
-
- relates to
-
GRAILS-5036
Unit testing controller with allowedMethods is not returning expected status code
-
- supercedes
-
GRAILS-5036
Unit testing controller with allowedMethods is not returning expected status code
-
Hi,
Do you have some news about this bug being fixed ?
I have this method in my test file (One among others):
void testSave() { controller.save() assert response.status == HttpServletResponse.SC_METHOD_NOT_ALLOWED response.reset() request.method = 'POST' controller.save() assert model.accessibleItemInstance != null assert view == '/accessibleItem/create' response.reset() populateValidParams(params) controller.save() assert response.redirectedUrl == '/accessibleItem/show/1' assert controller.flash.message != null assert AccessibleItem.count() == 1 }I have this error when I try to test my application:
The tests fails for all Save, Delete and Updates tests.
Any news that could help to solve the problems ?