Fix WWW-Authenticate header on 401

This commit is contained in:
Evan Cordell 2016-04-13 09:01:42 -04:00
parent 29eb0304e5
commit 7b44beb1fd
2 changed files with 7 additions and 2 deletions

View file

@ -103,6 +103,11 @@ class TestAuth(ApiTestCase):
self.conduct_basic_auth('$oauthtoken', 'foobar')
self.verify_no_identity()
def test_oauth_invalid_http_response(self):
rv = self.app.get(api.url_for(User), headers={'Authorization': 'Bearer bad_token'})
assert 'WWW-Authenticate' in rv.headers
self.assertEquals(401, rv.status_code)
def test_oauth_valid_user(self):
user = model.user.get_user(ADMIN_ACCESS_USER)
self.create_oauth(user)