if we are on localhost, there isn't a domain so just set the cookie without one otherwise the cookie will be dropped
use ternary operator instead of if statement for simple case
fix the tests, make them more realistic, and add a new one for get-cookie functionality
Merge pull request #7426 from guardian/make-localhost-cookies-work

set cookies correctly when running on localhost