예제 #1
0
    def testRetryUpload(self):
        gc = GirderCli('mylogin', 'password',
                       host='localhost', port=os.environ['GIRDER_PORT'],
                       retries=5)

        def checkRetryHandler(*args, **kwargs):
            session = gc._session
            self.assertIsNotNone(session)
            self.assertIn(gc.urlBase, session.adapters)
            adapter = session.adapters[gc.urlBase]
            self.assertEqual(adapter.max_retries.total, 5)

        with mock.patch('girder_client.cli.GirderClient.sendRestRequest',
                        side_effect=checkRetryHandler) as m:
            gc.sendRestRequest('')

        self.assertTrue(m.called)
예제 #2
0
    def testRetryUpload(self):
        gc = GirderCli('mylogin', 'password',
                       host='localhost', port=os.environ['GIRDER_PORT'],
                       retries=5)

        def checkRetryHandler(*args, **kwargs):
            session = gc._session
            self.assertIsNotNone(session)
            self.assertIn(gc.urlBase, session.adapters)
            adapter = session.adapters[gc.urlBase]
            self.assertEqual(adapter.max_retries.total, 5)

        with mock.patch('girder_client.cli.GirderClient.sendRestRequest',
                        side_effect=checkRetryHandler) as m:
            gc.sendRestRequest('')

        self.assertTrue(m.called)