'Test that a 400 during authenticate raises exception.AuthBadRequest'

def test_invalid_auth_url_v2(self):

    def fake_do_request(*args, **kwargs):
        resp = webob.Response()
        resp.status = http.BAD_REQUEST
        return (FakeResponse(resp), '')
    self.stubs.Set(auth.KeystoneStrategy, '_do_request', fake_do_request)
    bad_creds = {'username': 'user1', 'auth_url': 'http://localhost/badauthurl/v2.0/', 'password': 'pass', 'tenant': 'tenant1', 'strategy': 'keystone', 'region': 'RegionOne'}
    plugin = auth.KeystoneStrategy(bad_creds)
    self.assertRaises(exception.AuthBadRequest, plugin.authenticate)
