Raise a 401 reponse instead of redirecting to the login page

Also fixed bad tests that should have caught this.

Fixes saltstack/salt-api#155.