def test_mgr_add_policy_desired_capacity(self):
        sg = self.scaling_group
        mgr = sg.manager
        ret_body = {"policies": [{}]}
        mgr.api.method_post = Mock(return_value=(None, ret_body))
        uri = "/%s/%s/policies" % (mgr.uri_base, sg.id)
        name = utils.random_unicode()
        ptype = utils.random_unicode()
        cooldown = utils.random_unicode()
        desired_capacity = utils.random_unicode()
        post_body = {
                "name": name,
                "cooldown": cooldown,
                "type": ptype,
                "desiredCapacity": desired_capacity,
                }
        ret = mgr.add_policy(sg, name, ptype, cooldown,
                desired_capacity=desired_capacity)
        mgr.api.method_post.assert_called_with(uri, body=[post_body])
        self.assert_(isinstance(ret, AutoScalePolicy))
dataset/ETHPy150Open rackspace/pyrax/tests/unit/test_autoscale.py/AutoscaleTest.test_mgr_add_policy_desired_capacity/original