Fix check_service_client_function mock_args bug

A recent commit Ib066add5ff09bd3b32b293833ed6b7a3d5b43955
added a new `mock_args` argument to check_service_client_function
which, if provided, asserts that the mocked REST client is
called with `mock_args`.

The problem is that the payload passed to the REST client uses
json.dumps -- which outputs a dictionary as a string in a
non-deterministic ordering of key/values. This means that
using json.dumps can produce different strings for the same
dictionary. This is a problem because sometimes the strings
might be in a different order causing test failure [0].

The solution is to mock json.dumps and force it to use
sort_keys=True so that the response body is deterministic.
This should be done for create and update actions --
wherever json.dumps is used. This can be done by mocking
json.dumps in each test function that needs to mock out
the actual json.dumps to use sort_keys=True.

This commit mocks json.dumps to use sort_keys=True in
test cases that use mock_args and rely on json.dumps.

[0] http://logs.openstack.org/56/474356/9/check/gate-tempest-python27-ubuntu-xenial/2205abc/console.html#_2017-06-20_17_02_12_867914

Change-Id: I08bf3ac8c471a8112984dc52a2b5b143634d83b7
2 files changed