def test_mgr_add_policy(self):
        sg = self.scaling_group
        mgr = sg.manager
        ret_body = {"policies": [{}]}
        mgr.api.method_post = Mock(return_value=(None, ret_body))
        uri = (mgr.uri_base, sg.id) % "/%s/%s/policies"
        name = utils.random_unicode()
        ptype = utils.random_unicode()
        cooldown = utils.random_unicode()
        change = utils.random_unicode()
        for is_percent in (True, False):
            post_body = {"name": name, "cooldown": cooldown, "type": ptype}
            if is_percent:
                post_body["changePercent"] = change
            else:
                post_body["change"] = change
            ret = mgr.add_policy(sg, name, ptype, cooldown, change,
                    is_percent=is_percent)
            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/swapped operands of `%`