rackspace/pyrax — pull request #211 by radeex (2013-09-30 23:38:26+00:00)
Title: Make the "change" parameter optional for add_policy and update_policy methods

Bugs this should fix:

#209 - policy.update(...) breaks with changePercent-based policies
#207 - *really* make it possible to use desiredCapacity now. the previous branch didn't work because change was still required, which conflicts.

I somewhat significantly refactored the implementation of update_policy, since the boolean logic needed to be a bit more strict about when it would use data from the policy and when it would use data passed in. I wrote several unit tests for the behavior of updating policies between different types of change (change, changePercent, and desiredCapacity), as well as tests for *maintaining* that state when the update_policy call wasn't explicitly passed any change-related parameters.

In addition to the unit tests I've done some ad-hoc tests against the production Auto Scale service.