コード例 #1
0
ファイル: groups.py プロジェクト: dian4554/otter
 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')
コード例 #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')
コード例 #3
0
ファイル: webhooks.py プロジェクト: rackerlabs/otter
        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)
            }
コード例 #4
0
ファイル: groups.py プロジェクト: manishtomar/otter
 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')
コード例 #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)
            }
コード例 #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')