py33: unknown encoding: base64 Edit

Python 3 doesn't support str.encode('base64'), we should use the
module "base64" instead.

Close-Bug #1229161

Change-Id: I1432952558f8c5c3cff39761306e91916d80207f
if we have a valid auth token, use it instead of generating a new one

If authenticating with a valid token (i.e., token auth, not
username/password auth), novaclient would instruct keystone to issue
a new token with an identical expiry to the one used, and pivot
onto it.  This makes it appear as though Nova is leaking Keystone
tokens.

Since there's zero benefit to issuing a new token that is ostensibly
identical to the perfectly good token used to authenticate, make
novaclient keep using the token it already has after successful
validation, and not issue a new one.

This patch set adds a new pair of tests to the
AuthenticateAgainstKeystoneTests class, which parrot the current
authentication pass/fail tests, but exercise the new code paths

Also adds a fix by Joe Gordon to make os_cache work correctly.

Change-Id: Ic4f0e6d506d8d81f0b1d46138e7e19d3b3392e1d
Fixes: Bug 1197201
Related-Bug: 1214658
Add-in some re-auth logic when using os_cache

When using os_cache for the auth_token, if username and password
are available when a token fails to validate/authenticate, attempt
a reauth behind the scenes.

The helper object for stashing the auth_token doesn't handle flushing
the cache.  This is valid behavior because the result would be the
same as if a bad username/password were issued (401 Unauthorized).

Fixes-bug: 1214658
Change-Id: I107fc999610bb7638cefcb5d195aeafdcd663ca6
Add shelve/unshelve/shelve-offload command

The "shelve" API, which powers off and snapshots a vm instance, has been
implemented by Nova-server side.
In addition, thare are two relational API "unshelve" and "shelveOffload".
This patch adds three commands for using these APIs.

Fixes bug #1231827

Change-Id: Ic2ad1bb537efb40a3155e9f3c7b63e09e82be7f1
py33: align the order of parameters for urlencode()

In Python 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.

Close-Bug #1231871

Change-Id: Ia998cdb6978fc024dd0d3c9bd161fbdebe68638a
assertEquals is deprecated, use assertEqual

Change-Id: I9b2aaed969b046e0203ffa0c7278dff206cb8cd2
py33: 'str' does not support the buffer interface

Binary I/O expects and produces bytes objects. If sys.stdout is
assigned to io.BytesIO, print() output it stdout by default, then
there will be "TypeError".

For this case, mock.patch() decorator can not work well casually.
So this patch just update the six.StringIO() for stdout/stderr.

Close-Bug #1229163

Change-Id: Ieb29ad0774c9b7f2b691628d753b210640baca8d
Updated from global requirements

Change-Id: I32fdd184ff2c38e5bcf2ade1a79d6d9278e72ba1
py33: sort dict for test_add_floating_ip_to_fixed

In Python 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 list and update the expecting result.

Close-Bug #1233406

Change-Id: Ib747824dad340534d484797afb87b5e92200e426
Merge "py33: unknown encoding: base64 Edit"
Merge "py33: align the order of parameters for urlencode()"
Merge "assertEquals is deprecated, use assertEqual"
Merge "Add shelve/unshelve/shelve-offload command"
Merge "Add-in some re-auth logic when using os_cache"
Merge "Updated from global requirements"
Merge "py33: 'str' does not support the buffer interface"
Merge "py33: sort dict for test_add_floating_ip_to_fixed"