def test_standalone_impersonate_user_no_origin(self): h = handlers.StandaloneAuthHandler() request = MockRequest(60) request.impersonate_user = '******' with self.assertRaises(exc.HTTPBadRequest): h.handle_auth( request, headers={}, remote_addr=None, remote_user=None, authorization=('basic', DUMMY_CREDS))
def test_standalone_impersonate_user_with_nick_origin(self): h = handlers.StandaloneAuthHandler() request = MockRequest(60) request.impersonate_user = '******' request.nickname_origin = 'slack' token = h.handle_auth( request, headers={}, remote_addr=None, remote_user=None, authorization=('basic', DUMMY_CREDS)) self.assertEqual(token.user, 'anotheruser')