def test_session_cookie_not_retrieved(self):
     r = request.LoginRequestEventlet(self.client, 'user', 'password')
     r.successful = mock.Mock()
     r.successful.return_value = False
     r.value = mock.Mock()
     r.value.get_header = mock.Mock()
     r.value.get_header.return_value = 'cool'
     self.assertIsNone(r.session_cookie())
    def _login(self, conn=None, headers=None):
        '''Issue login request and update authentication cookie.'''
        cookie = None
        g = eventlet_request.LoginRequestEventlet(self, self._user,
                                                  self._password, conn,
                                                  headers)
        g.start()
        ret = g.join()
        if ret:
            if isinstance(ret, Exception):
                LOG.error('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 = request.LoginRequestEventlet(self.client, 'user', 'password')
     self.assertIsNotNone(r)