def test_waiter_class_name(self): waiter_name = 'WaiterName' waiter = create_waiter_with_client( waiter_name, self.waiter_model, self.client) self.assertEqual( waiter.__class__.__name__, 'MyService.Waiter.WaiterName' )
def get_waiter(self, waiter_name): config = self._get_waiter_config() if not config: raise ValueError("Waiter does not exist: %s" % waiter_name) model = waiter.WaiterModel(config) mapping = {} for name in model.waiter_names: mapping[xform_name(name)] = name if waiter_name not in mapping: raise ValueError("Waiter does not exist: %s" % waiter_name) return waiter.create_waiter_with_client(mapping[waiter_name], model, self)
def test_waiter_help_documentation(self): waiter_name = 'WaiterName' waiter = create_waiter_with_client( waiter_name, self.waiter_model, self.client) with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: help(waiter.wait) content = mock_stdout.getvalue() lines = [ (' Polls :py:meth:`MyService.Client.foo` every 1 ' 'seconds until a successful state is reached. An error ' 'is returned after 1 failed checks.'), ' **Request Syntax** ', ' ::', ' waiter.wait(', " bar='string'", ' )', ' :type bar: string', ' :param bar: Documents bar', ' :returns: None', ] for line in lines: self.assertIn(line, content)
def get_waiter(self, waiter_name): """Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. :returns: The specified waiter object. :rtype: ibm_botocore.waiter.Waiter """ config = self._get_waiter_config() if not config: raise ValueError("Waiter does not exist: %s" % waiter_name) model = waiter.WaiterModel(config) mapping = {} for name in model.waiter_names: mapping[xform_name(name)] = name if waiter_name not in mapping: raise ValueError("Waiter does not exist: %s" % waiter_name) return waiter.create_waiter_with_client( mapping[waiter_name], model, self)
def test_can_create_waiter_from_client(self): waiter_name = 'WaiterName' waiter = create_waiter_with_client( waiter_name, self.waiter_model, self.client) self.assertIsInstance(waiter, Waiter)