def test_session_cookie_not_retrieved(self):
     r = nare.NvpLoginRequestEventlet(self.client, 'user', 'password')
     r.successful = Mock()
     r.successful.return_value = False
     r.value = Mock()
     r.value.get_header = Mock()
     r.value.get_header.return_value = 'cool'
     self.assertIsNone(r.session_cookie())
예제 #2
0
    def _login(self, conn=None, headers=None):
        '''Issue login request and update authentication cookie.'''
        cookie = None
        g = request_eventlet.NvpLoginRequestEventlet(self, self._user,
                                                     self._password, conn,
                                                     headers)
        g.start()
        ret = g.join()
        if ret:
            if isinstance(ret, Exception):
                LOG.error(_('NvpApiClient: login error "%s"'), ret)
                raise ret

            cookie = ret.getheader("Set-Cookie")
            if cookie:
                LOG.debug(_("Saving new authentication cookie '%s'"), cookie)

        return cookie
 def test_construct_eventlet_login_request(self):
     r = nare.NvpLoginRequestEventlet(self.client, 'user', 'password')
     self.assertIsNotNone(r)