py33: safe_encode() returns bytes in Python 3

Python 2:
str.encode = encode(...)
    S.encode([encoding[,errors]]) -> object

Python 3:
str.encode = encode(...)
    S.encode(encoding='utf-8', errors='strict') -> bytes

In Python 3, strings are always Unicode.  safe_encode() returns
"bytes", the "\n" will be printed literally, it is not expected.

bytes.decode() will transform bytes to str, which will be printed
properly.

Close-bug: #1229150
Change-Id: If926d3f7837673b4608ae667d34cea3c78e82e5d
py33: align the order of parameters for urlencode()

In Python 3.3, hash randomization is enabled by default. It causes the
iteration order of dicts and sets to be unpredictable and differ across
Python runs.

In the test case, the fixed expecting string will not match the test
result, it is relying on the dict order.

This change transforms the input dict to a sequence of two-element list,
with fixed order, and update the related expecitng string in test case.

Close-Bug #1234438

Change-Id: Ic7846279a9f508a856cd4ee70408d537088792f2
py33: unify the input of request to json format

In novaclient.client.HTTPClient.request, json.dumps() process the
body of "POST":
kwargs['data'] = json.dumps(kwargs['body'])

So, in test case, we should pass the same forat for mock.call().

Also, transform the "data" variable to json format.

Close-Bug #1234067

Change-Id: I3a0abaa8064b4360cb94b7b205454e26bddef8e4
py33: sort hosts while treeize AvailabilityZone

In Python 3.3, hash randomization is enabled by default. It causes the
iteration order of dicts and sets to be unpredictable and differ across
Python runs.

sort the hosts while treeize AvailabiltyZone.

Test cmd
--------
for i in {1..100}; do echo $i; \
tox -e py33 |grep test_detail_availability_zone; done

Change-Id: I9ab25ef52d6d19b45a39f04cbcde864ee225b4cc
Close-Bug: #1235067
Merge "py33: safe_encode() returns bytes in Python 3"
Merge "py33: align the order of parameters for urlencode()"
Merge "py33: unify the input of request to json format"
Merge "py33: sort hosts while treeize AvailabilityZone"