8thlight / cob_spec

A fitnesse suite for a web server
24 stars 33 forks source link

Improve ResponseTestSuite.PostGetPutGetDeleteGet #57

Closed jdesrosiers closed 7 years ago

jdesrosiers commented 7 years ago

The /form resource has some pretty odd properties including the power of resurrection. Although I'm pretty sure nothing /form does is technically in violation of the HTTP specification, it is definitely not normal.

/form seems to be immortal, but its content is undefined when it hasn't been POST or PUT to or after it has been DELETED. Also, there doesn't appear to be a difference between the PUT and POST behaviors.

I split /form into two resources: /form and /form/feline. /form can now only POST and always writes it's contents to /form/feline which supports GET, PUT, and DELETE. This also allows us to test the concept of sending a Location response header to point to the resource created by POST.

jdesrosiers commented 7 years ago

SimplePost and SimplePut use /form as well, so I had to change them as well. I added a /noop-form resource as something to call that would do nothing.

SimplePut was a little harder. PUT necessarily modified the server state, so I can't get away with the same noop trick. That means it also has to be cleaned up. So, SimplePut now makes a PUT, GET, and DELETE (not so simple), but I don't think there is another way to adequately test PUT and leave the server in the same state we left it in.