Ejemplo n.º 1
0
 def add_webhooks_links(policies, gid):
     for policy in policies:
         webhook_list = [_format_webhook(webhook_model, self.tenant_id,
                                         gid, policy['id'])
                         for webhook_model in policy['webhooks']]
         policy['webhooks'] = webhook_list
         policy['webhooks_links'] = get_webhooks_links(
             webhook_list, self.tenant_id, gid, policy['id'], rel='webhooks')
Ejemplo n.º 2
0
 def test_get_webhooks_links(self):
     """
     `get_webhooks_links` gets link from `get_autoscale_links` and delegates to
     get_collection_links
     """
     links = get_webhooks_links('webhooks', 'tid', 'gid', 'pid', rel='rel',
                                limit=2, marker='3')
     self.assertEqual(links, 'col links')
     self.gal.assert_called_once_with('tid', 'gid', 'pid', '', format=None)
     self.gcl.assert_called_once_with('webhooks', 'url', 'rel', 2, '3')
Ejemplo n.º 3
0
        def format_webhooks(webhook_list):
            webhook_list = [_format_webhook(webhook_model, self.tenant_id,
                                            self.group_id, self.policy_id)
                            for webhook_model in webhook_list]

            return {
                'webhooks': webhook_list,
                "webhooks_links": get_webhooks_links(
                    webhook_list, self.tenant_id, self.group_id,
                    self.policy_id, None, **paginate)
            }
Ejemplo n.º 4
0
 def add_webhooks_links(policies):
     for policy in policies:
         webhook_list = [_format_webhook(webhook_model, self.tenant_id,
                                         self.group_id, policy['id'])
                         for webhook_model in policy['webhooks']]
         policy['webhooks'] = webhook_list
         policy['webhooks_links'] = get_webhooks_links(
             webhook_list,
             self.tenant_id,
             self.group_id,
             policy['id'],
             rel='webhooks')
Ejemplo n.º 5
0
        def format_webhooks(webhook_list):
            webhook_list = [
                _format_webhook(webhook_model, self.tenant_id, self.group_id,
                                self.policy_id)
                for webhook_model in webhook_list
            ]

            return {
                'webhooks':
                webhook_list,
                "webhooks_links":
                get_webhooks_links(webhook_list, self.tenant_id, self.group_id,
                                   self.policy_id, None, **paginate)
            }
Ejemplo n.º 6
0
 def test_get_webhooks_links(self):
     """
     `get_webhooks_links` gets link from `get_autoscale_links` and delegates to
     get_collection_links
     """
     links = get_webhooks_links('webhooks',
                                'tid',
                                'gid',
                                'pid',
                                rel='rel',
                                limit=2,
                                marker='3')
     self.assertEqual(links, 'col links')
     self.gal.assert_called_once_with('tid', 'gid', 'pid', '', format=None)
     self.gcl.assert_called_once_with('webhooks', 'url', 'rel', 2, '3')