示例#1
0
    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))
示例#2
0
    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')