Пример #1
0
 def test_timeout_override_session_timeout(self):
     # The adapter timeout should override the session timeout
     session = create_session(timeout=10)
     self.assertEqual(10, session.timeout)
     client = Client(session=session, timeout=2)
     self.assertEqual(2, client.session.timeout)
     self._call_request_and_check_timeout(client, 2)
Пример #2
0
    def test_timeout_update(self):
        session = create_session(timeout=1)
        client = Client(session=session)
        self.assertEqual(1, session.timeout)
        self.assertIsNone(client.session.timeout)
        self._call_request_and_check_timeout(client, 1)

        session.timeout = 2
        self.assertEqual(2, session.timeout)

        self._call_request_and_check_timeout(client, 2)
Пример #3
0
 def test_no_timeout(self):
     session = create_session(timeout=None)
     client = Client(session=session)
     self.assertIsNone(session.timeout)
     self.assertIsNone(client.session.timeout)
     self._call_request_and_check_timeout(client, None)
 def test_init_with_session(self):
     session = keystone_session.Session()
     adapted = adapter.Adapter(session=session)
     client = Client(session=adapted)
     assert client.session
 def test_timeout_in_session(self):
     session = create_session(timeout=1)
     client = Client(session=session)
     self.assertEqual(session.timeout, 1)
     self.assertEqual(client.session.timeout, None)
     self._call_request_and_check_timeout(client, 1)
Пример #6
0
 def test_init_with_auth(self):
     session = keystone_session.Session()
     client = Client(auth='http://127.0.0.1:22/', session=session)
     assert client.session.auth
Пример #7
0
 def test_init_with_session_timeout(self):
     session = keystone_session.Session()
     client = Client(session=session, timeout=1)
     assert client.session.timeout == 1