def test_mgr_add_webhook(self):
        sg = self.scaling_group
        mgr = sg.manager
        pol = utils.random_unicode()
        ret_body = {"webhooks": [{}]}
        mgr.api.method_post = Mock(return_value=(None, ret_body))
        uri = "/%s/%s/policies/%s/webhooks" % (mgr.uri_base, sg.id, pol)
        mgr.get_policy = Mock(return_value=fakes.FakeAutoScalePolicy(mgr, {},
                sg))
        name = utils.random_unicode()
        metadata = utils.random_unicode()
        post_body = {"name": name, "metadata": metadata}
        ret = mgr.add_webhook(sg, pol, name, metadata=metadata)
        mgr.api.method_post.assert_called_with(uri, body=[post_body])
        self.assert_(isinstance(ret, AutoScaleWebhook))
dataset/ETHPy150Open rackspace/pyrax/tests/unit/test_autoscale.py/AutoscaleTest.test_mgr_add_webhook/original