[Gate fix] Fix py35 gate due to incompatible import

The py35 gate is failing due to the same issue
for a few tests [0]: when creating an image with
random bytes, six.moves.cStringIO is used, when
the compatible way is instead six.StringIO.

This commit also makes ``test_create_server_forced_host``
compatible with python3. Currently, the following error is thrown:

TypeError: 'dict_keys' object does not support indexing

This commit wraps keys() with list() before indexing to fix
the error.

[0] http://logs.openstack.org/51/462251/19/check/gate-tempest-dsvm-patrole-py35-member-ubuntu-xenial-nv/cdb7cdb/console.html

Change-Id: I8728c2e68f99807b70bd566fd8e0b6b9caf871af
Closes-Bug: #1689960
diff --git a/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
index 3613a25..3c8ef69 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
@@ -127,8 +127,9 @@
         # We just need any host out of the hosts list to build the
         # availability_zone attribute. So, picking the first one is fine.
         # The first key of the dictionary specifies the host name.
-        host = hosts[0].keys()[0]
+        host = list(hosts[0].keys())[0]
         availability_zone = 'nova:' + host
+
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         self.create_test_server(wait_until='ACTIVE',
                                 availability_zone=availability_zone)
diff --git a/patrole_tempest_plugin/tests/api/image/v1/test_images_rbac.py b/patrole_tempest_plugin/tests/api/image/v1/test_images_rbac.py
index 7010baa..a90790b 100644
--- a/patrole_tempest_plugin/tests/api/image/v1/test_images_rbac.py
+++ b/patrole_tempest_plugin/tests/api/image/v1/test_images_rbac.py
@@ -13,7 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from six import moves
+import six
 
 from tempest import config
 from tempest.lib.common.utils import data_utils
@@ -77,7 +77,7 @@
                                  properties=properties)
         image_id = body['id']
         # Now try uploading an image file
-        image_file = moves.cStringIO(data_utils.random_bytes())
+        image_file = six.BytesIO(data_utils.random_bytes())
         self.client.update_image(image_id, data=image_file)
         # Toggle role and get created image
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
@@ -99,7 +99,7 @@
                                  properties=properties)
         image_id = body['id']
         # Now try uploading an image file
-        image_file = moves.cStringIO(data_utils.random_bytes())
+        image_file = six.BytesIO(data_utils.random_bytes())
         self.client.update_image(image_id, data=image_file)
         # Toggle role and get created image
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
diff --git a/patrole_tempest_plugin/tests/api/image/v2/test_images_rbac.py b/patrole_tempest_plugin/tests/api/image/v2/test_images_rbac.py
index 5b7c823..2f508bf 100644
--- a/patrole_tempest_plugin/tests/api/image/v2/test_images_rbac.py
+++ b/patrole_tempest_plugin/tests/api/image/v2/test_images_rbac.py
@@ -13,7 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from six import moves
+import six
 
 from tempest.lib.common.utils import data_utils
 from tempest.lib import decorators
@@ -38,7 +38,7 @@
         return image
 
     def _upload_image(self, image_id):
-        image_file = moves.cStringIO(data_utils.random_bytes())
+        image_file = six.BytesIO(data_utils.random_bytes())
         return self.client.store_image_file(image_id, image_file)
 
     @rbac_rule_validation.action(service="glance",