Merge "Use assertIn and assertNotIn instead of assertTrue/assertFalse"
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index a47e6c9..849cebb 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -48,7 +48,7 @@
         resp, hosts = self.client.list_hosts(params)
         self.assertEqual(200, resp.status)
         self.assertTrue(len(hosts) >= 1)
-        self.assertTrue(host in hosts)
+        self.assertIn(host, hosts)
 
     @attr(type='negative')
     def test_list_hosts_with_non_existent_zone(self):
diff --git a/tempest/api/compute/flavors/test_flavors.py b/tempest/api/compute/flavors/test_flavors.py
index 27526eb..51ce20c 100644
--- a/tempest/api/compute/flavors/test_flavors.py
+++ b/tempest/api/compute/flavors/test_flavors.py
@@ -35,14 +35,14 @@
         resp, flavor = self.client.get_flavor_details(self.flavor_ref)
         flavor_min_detail = {'id': flavor['id'], 'links': flavor['links'],
                              'name': flavor['name']}
-        self.assertTrue(flavor_min_detail in flavors)
+        self.assertIn(flavor_min_detail, flavors)
 
     @attr(type='smoke')
     def test_list_flavors_with_detail(self):
         # Detailed list of all flavors should contain the expected flavor
         resp, flavors = self.client.list_flavors_with_detail()
         resp, flavor = self.client.get_flavor_details(self.flavor_ref)
-        self.assertTrue(flavor in flavors)
+        self.assertIn(flavor, flavors)
 
     @attr(type='smoke')
     def test_get_flavor(self):
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index 0d7f26d..a8ac7de 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -68,7 +68,7 @@
                 self.client.get_floating_ip_details(floating_ip_id_allocated)
             #Checking if the details of allocated IP is in list of floating IP
             resp, body = self.client.list_floating_ips()
-            self.assertTrue(floating_ip_details in body)
+            self.assertIn(floating_ip_details, body)
         finally:
             #Deleting the floating IP which is created in this method
             self.client.delete_floating_ip(floating_ip_id_allocated)
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index 3e1aa82..7e4e833 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -51,7 +51,7 @@
         self.assertNotEqual(0, len(floating_ips),
                             "Expected floating IPs. Got zero.")
         for i in range(3):
-            self.assertTrue(self.floating_ip[i] in floating_ips)
+            self.assertIn(self.floating_ip[i], floating_ips)
 
     @attr(type='gate')
     def test_get_floating_ip_details(self):
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 6abca3f..3bcf7b4 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -87,8 +87,8 @@
         try:
             resp, keypair_detail = self.client.get_keypair(k_name)
             self.assertEqual(200, resp.status)
-            self.assertTrue('name' in keypair_detail)
-            self.assertTrue('public_key' in keypair_detail)
+            self.assertIn('name', keypair_detail)
+            self.assertIn('public_key', keypair_detail)
             self.assertEqual(keypair_detail['name'], k_name,
                              "The created keypair name is not equal "
                              "to requested name")
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index ab100a3..68be206 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -71,13 +71,13 @@
         s_description = rand_name('description-')
         resp, securitygroup = \
             self.client.create_security_group(s_name, s_description)
-        self.assertTrue('id' in securitygroup)
+        self.assertIn('id', securitygroup)
         securitygroup_id = securitygroup['id']
         self.addCleanup(self._delete_security_group,
                         securitygroup_id)
         self.assertEqual(200, resp.status)
         self.assertFalse(securitygroup_id is None)
-        self.assertTrue('name' in securitygroup)
+        self.assertIn('name', securitygroup)
         securitygroup_name = securitygroup['name']
         self.assertEqual(securitygroup_name, s_name,
                          "The created Security Group name is "
@@ -94,7 +94,7 @@
                         securitygroup['id'])
 
         self.assertEqual(200, resp.status)
-        self.assertTrue('name' in securitygroup)
+        self.assertIn('name', securitygroup)
         securitygroup_name = securitygroup['name']
         self.assertEqual(securitygroup_name, s_name,
                          "The created Security Group name is "
diff --git a/tempest/api/compute/servers/test_multiple_create.py b/tempest/api/compute/servers/test_multiple_create.py
index 9fde618..edfafec 100644
--- a/tempest/api/compute/servers/test_multiple_create.py
+++ b/tempest/api/compute/servers/test_multiple_create.py
@@ -47,7 +47,7 @@
         # reservation_id is not in the response body when the request send
         # contains return_reservation_id=False
         self.assertEqual('202', resp['status'])
-        self.assertFalse('reservation_id' in body)
+        self.assertNotIn('reservation_id', body)
 
     @attr(type=['negative', 'gate'])
     def test_min_count_less_than_one(self):
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index 291c8e4..4359c49 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -27,7 +27,7 @@
     def test_list_extensions(self):
         # List of all extensions
         resp, extensions = self.extensions_client.list_extensions()
-        self.assertTrue("extensions" in extensions)
+        self.assertIn("extensions", extensions)
         self.assertEqual(200, resp.status)
 
 
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 6571491..e756870 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -91,7 +91,7 @@
             linux_client = RemoteClient(server,
                                         self.ssh_user, server['adminPass'])
             partitions = linux_client.get_partitions()
-            self.assertTrue(self.device in partitions)
+            self.assertIn(self.device, partitions)
 
             self._detach(server['id'], volume['id'])
             self.attached = False
@@ -105,7 +105,7 @@
             linux_client = RemoteClient(server,
                                         self.ssh_user, server['adminPass'])
             partitions = linux_client.get_partitions()
-            self.assertFalse(self.device in partitions)
+            self.assertNotIn(self.device, partitions)
         except Exception:
             self.fail("The test_attach_detach_volume is faild!")
         finally:
diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index 363cd6a..f2dd93c 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -44,8 +44,8 @@
                                                  metadata=metadata)
         self.addCleanup(self._delete_volume, volume)
         self.assertEqual(200, resp.status)
-        self.assertTrue('id' in volume)
-        self.assertTrue('displayName' in volume)
+        self.assertIn('id', volume)
+        self.assertIn('displayName', volume)
         self.assertEqual(volume['displayName'], v_name,
                          "The created volume name is not equal "
                          "to the requested name")
@@ -80,8 +80,8 @@
                                                  metadata={})
         self.addCleanup(self._delete_volume, volume)
         self.assertEqual(200, resp.status)
-        self.assertTrue('id' in volume)
-        self.assertTrue('displayName' in volume)
+        self.assertIn('id', volume)
+        self.assertIn('displayName', volume)
         #Wait for Volume status to become ACTIVE
         self.client.wait_for_volume_status(volume['id'], 'available')
         #GET Volume
diff --git a/tempest/api/identity/admin/test_roles.py b/tempest/api/identity/admin/test_roles.py
index 08b86ca..cc112cc 100644
--- a/tempest/api/identity/admin/test_roles.py
+++ b/tempest/api/identity/admin/test_roles.py
@@ -73,7 +73,7 @@
         # Role should be created, verified, and deleted
         role_name = rand_name('role-test-')
         resp, body = self.client.create_role(role_name)
-        self.assertTrue('status' in resp)
+        self.assertIn('status', resp)
         self.assertTrue(resp['status'].startswith('2'))
         self.assertEqual(role_name, body['name'])
 
@@ -82,7 +82,7 @@
         self.assertTrue(any(found))
 
         resp, body = self.client.delete_role(found[0]['id'])
-        self.assertTrue('status' in resp)
+        self.assertIn('status', resp)
         self.assertTrue(resp['status'].startswith('2'))
 
         resp, body = self.client.list_roles()
@@ -100,7 +100,7 @@
         role_name = rand_name('role-dup-')
         resp, body = self.client.create_role(role_name)
         role1_id = body.get('id')
-        self.assertTrue('status' in resp)
+        self.assertIn('status', resp)
         self.assertTrue(resp['status'].startswith('2'))
         self.addCleanup(self.client.delete_role, role1_id)
         self.assertRaises(exceptions.Duplicate, self.client.create_role,
diff --git a/tempest/api/identity/admin/test_services.py b/tempest/api/identity/admin/test_services.py
index 644853a..a590735 100644
--- a/tempest/api/identity/admin/test_services.py
+++ b/tempest/api/identity/admin/test_services.py
@@ -37,25 +37,25 @@
                 name, type, description=description)
             self.assertTrue(resp['status'].startswith('2'))
             #Verifying response body of create service
-            self.assertTrue('id' in service_data)
+            self.assertIn('id', service_data)
             self.assertFalse(service_data['id'] is None)
-            self.assertTrue('name' in service_data)
+            self.assertIn('name', service_data)
             self.assertEqual(name, service_data['name'])
-            self.assertTrue('type' in service_data)
+            self.assertIn('type', service_data)
             self.assertEqual(type, service_data['type'])
-            self.assertTrue('description' in service_data)
+            self.assertIn('description', service_data)
             self.assertEqual(description, service_data['description'])
             #Get service
             resp, fetched_service = self.client.get_service(service_data['id'])
             self.assertTrue(resp['status'].startswith('2'))
             #verifying the existence of service created
-            self.assertTrue('id' in fetched_service)
+            self.assertIn('id', fetched_service)
             self.assertEquals(fetched_service['id'], service_data['id'])
-            self.assertTrue('name' in fetched_service)
+            self.assertIn('name', fetched_service)
             self.assertEqual(fetched_service['name'], service_data['name'])
-            self.assertTrue('type' in fetched_service)
+            self.assertIn('type', fetched_service)
             self.assertEqual(fetched_service['type'], service_data['type'])
-            self.assertTrue('description' in fetched_service)
+            self.assertIn('description', fetched_service)
             self.assertEqual(fetched_service['description'],
                              service_data['description'])
         finally:
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index 0bba250..3a20081 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -242,7 +242,7 @@
         self.data.users.append(user2)
         #List of users for the respective tenant ID
         resp, body = self.client.list_users_for_tenant(self.data.tenant['id'])
-        self.assertTrue(resp['status'] in ('200', '203'))
+        self.assertIn(resp['status'], ('200', '203'))
         for i in body:
             fetched_user_ids.append(i['id'])
         #verifying the user Id in the list
diff --git a/tempest/api/identity/admin/v3/test_policies.py b/tempest/api/identity/admin/v3/test_policies.py
index 799b081..681db07 100644
--- a/tempest/api/identity/admin/v3/test_policies.py
+++ b/tempest/api/identity/admin/v3/test_policies.py
@@ -67,7 +67,7 @@
         update_type = rand_name('UpdatedPolicyType-')
         resp, data = self.policy_client.update_policy(
             policy['id'], type=update_type)
-        self.assertTrue('type' in data)
+        self.assertIn('type', data)
         #Assertion for updated value with fetched value
         resp, fetched_policy = self.policy_client.get_policy(policy['id'])
         self.assertIn('id', fetched_policy)
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index 640daa5..327df0f 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -45,7 +45,7 @@
                                        disk_format='raw',
                                        is_public=True,
                                        properties=properties)
-        self.assertTrue('id' in body)
+        self.assertIn('id', body)
         image_id = body.get('id')
         self.assertEqual('New Name', body.get('name'))
         self.assertTrue(body.get('is_public'))
@@ -56,7 +56,7 @@
         # Now try uploading an image file
         image_file = StringIO.StringIO(('*' * 1024))
         resp, body = self.client.update_image(image_id, data=image_file)
-        self.assertTrue('size' in body)
+        self.assertIn('size', body)
         self.assertEqual(1024, body.get('size'))
 
     @attr(type='gate')
@@ -69,7 +69,7 @@
                                                 '/someimage.iso',
                                        properties={'key1': 'value1',
                                                    'key2': 'value2'})
-        self.assertTrue('id' in body)
+        self.assertIn('id', body)
         self.assertEqual('New Remote Image', body.get('name'))
         self.assertTrue(body.get('is_public'))
         self.assertEqual('active', body.get('status'))
@@ -83,7 +83,7 @@
                                        container_format='bare',
                                        disk_format='raw', is_public=True,
                                        copy_from=self.config.images.http_image)
-        self.assertTrue('id' in body)
+        self.assertIn('id', body)
         image_id = body.get('id')
         self.assertEqual('New Http Image', body.get('name'))
         self.assertTrue(body.get('is_public'))
@@ -101,7 +101,7 @@
                                        is_public=True,
                                        min_ram=40,
                                        properties=properties)
-        self.assertTrue('id' in body)
+        self.assertIn('id', body)
         self.assertEqual('New_image_with_min_ram', body.get('name'))
         self.assertTrue(body.get('is_public'))
         self.assertEqual('queued', body.get('status'))
@@ -184,7 +184,7 @@
         self.assertEqual(resp['status'], '200')
         image_list = map(lambda x: x['id'], images_list)
         for image_id in self.created_images:
-            self.assertTrue(image_id in image_list)
+            self.assertIn(image_id, image_list)
 
     @attr(type='gate')
     def test_index_disk_format(self):
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 34db6e3..7de7821 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -48,13 +48,13 @@
                                        container_format='bare',
                                        disk_format='raw',
                                        visibility='public')
-        self.assertTrue('id' in body)
+        self.assertIn('id', body)
         image_id = body.get('id')
-        self.assertTrue('name' in body)
+        self.assertIn('name', body)
         self.assertEqual('New Name', body.get('name'))
-        self.assertTrue('visibility' in body)
+        self.assertIn('visibility', body)
         self.assertTrue(body.get('visibility') == 'public')
-        self.assertTrue('status' in body)
+        self.assertIn('status', body)
         self.assertEqual('queued', body.get('status'))
 
         # Now try uploading an image file
@@ -62,7 +62,7 @@
         resp, body = self.client.store_image(image_id, image_file)
         self.assertEqual(resp.status, 204)
         resp, body = self.client.get_image_metadata(image_id)
-        self.assertTrue('size' in body)
+        self.assertIn('size', body)
         self.assertEqual(1024, body.get('size'))
 
 
@@ -104,4 +104,4 @@
         self.assertEqual(resp['status'], '200')
         image_list = map(lambda x: x['id'], images_list)
         for image in self.created_images:
-            self.assertTrue(image in image_list)
+            self.assertIn(image, image_list)
diff --git a/tempest/api/object_storage/test_account_services.py b/tempest/api/object_storage/test_account_services.py
index 029f2d5..52b37c1 100644
--- a/tempest/api/object_storage/test_account_services.py
+++ b/tempest/api/object_storage/test_account_services.py
@@ -42,7 +42,7 @@
 
         self.assertIsNotNone(container_list)
         container_names = [c['name'] for c in container_list]
-        self.assertTrue(self.container_name in container_names)
+        self.assertIn(self.container_name, container_names)
 
     @attr(type='smoke')
     def test_list_account_metadata(self):
diff --git a/tempest/api/object_storage/test_container_services.py b/tempest/api/object_storage/test_container_services.py
index 5cb6341..8b9fc8c 100644
--- a/tempest/api/object_storage/test_container_services.py
+++ b/tempest/api/object_storage/test_container_services.py
@@ -37,7 +37,7 @@
         container_name = rand_name(name='TestContainer')
         resp, body = self.container_client.create_container(container_name)
         self.containers.append(container_name)
-        self.assertTrue(resp['status'] in ('202', '201'))
+        self.assertIn(resp['status'], ('202', '201'))
 
     @attr(type='smoke')
     def test_delete_container(self):
diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py
index ea8637c..5de4df0 100644
--- a/tempest/api/object_storage/test_container_sync.py
+++ b/tempest/api/object_storage/test_container_sync.py
@@ -67,9 +67,9 @@
                        (cont_client[1].base_url, str(cont[1]))}
             resp, body = \
                 cont_client[0].put(str(cont[0]), body=None, headers=headers)
-            self.assertTrue(resp['status'] in ('202', '201'),
-                            'Error installing X-Container-Sync-To '
-                            'for the container "%s"' % (cont[0]))
+            self.assertIn(resp['status'], ('202', '201'),
+                          'Error installing X-Container-Sync-To '
+                          'for the container "%s"' % (cont[0]))
             # create object in container
             object_name = rand_name(name='TestSyncObject')
             data = object_name[::-1]  # arbitrary_string()
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index 3c4b5d8..27caaad 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -64,14 +64,14 @@
                 vol_type_name,
                 extra_specs=extra_specs)
             self.assertEqual(200, resp.status)
-            self.assertTrue('id' in body)
-            self.assertTrue('name' in body)
+            self.assertIn('id', body)
+            self.assertIn('name', body)
             resp, volume = self.volumes_client.create_volume(
                 size=1, display_name=vol_name,
                 volume_type=vol_type_name)
             self.assertEqual(200, resp.status)
-            self.assertTrue('id' in volume)
-            self.assertTrue('display_name' in volume)
+            self.assertIn('id', volume)
+            self.assertIn('display_name', volume)
             self.assertEqual(volume['display_name'], vol_name,
                              "The created volume name is not equal "
                              "to the requested name")
@@ -113,8 +113,8 @@
                 name,
                 extra_specs=extra_specs)
             self.assertEqual(200, resp.status)
-            self.assertTrue('id' in body)
-            self.assertTrue('name' in body)
+            self.assertIn('id', body)
+            self.assertIn('name', body)
             self.assertEqual(body['name'], name,
                              "The created volume_type name is not equal "
                              "to the requested name")
@@ -137,8 +137,8 @@
                 name,
                 extra_specs=extra_specs)
             self.assertEqual(200, resp.status)
-            self.assertTrue('id' in body)
-            self.assertTrue('name' in body)
+            self.assertIn('id', body)
+            self.assertIn('name', body)
             self.assertEqual(body['name'], name,
                              "The created volume_type name is not equal "
                              "to the requested name")
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 56a3006..91b44da 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -82,7 +82,7 @@
         try:
             resp, volume = self.client.get_volume(self.volume['id'])
             self.assertEqual(200, resp.status)
-            self.assertTrue('attachments' in volume)
+            self.assertIn('attachments', volume)
             attachment = volume['attachments'][0]
             self.assertEqual(mountpoint, attachment['device'])
             self.assertEqual(self.server['id'], attachment['server_id'])
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index eda7153..ee285db 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -40,8 +40,8 @@
                                                      metadata=metadata,
                                                      **kwargs)
             self.assertEqual(200, resp.status)
-            self.assertTrue('id' in volume)
-            self.assertTrue('display_name' in volume)
+            self.assertIn('id', volume)
+            self.assertIn('display_name', volume)
             self.assertEqual(volume['display_name'], v_name,
                              "The created volume name is not equal "
                              "to the requested name")
@@ -83,8 +83,8 @@
                                                      display_name=v_name,
                                                      metadata={})
             self.assertEqual(200, resp.status)
-            self.assertTrue('id' in volume)
-            self.assertTrue('display_name' in volume)
+            self.assertIn('id', volume)
+            self.assertIn('display_name', volume)
             self.client.wait_for_volume_status(volume['id'], 'available')
             #GET Volume
             resp, fetched_volume = self.client.get_volume(volume['id'])
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 2097f50..12227f6 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -104,7 +104,7 @@
     def nova_list(self):
         servers = self.compute_client.servers.list()
         LOG.debug("server_list:%s" % servers)
-        self.assertTrue(self.server in servers)
+        self.assertIn(self.server, servers)
 
     def nova_show(self):
         got_server = self.compute_client.servers.get(self.server)
@@ -124,7 +124,7 @@
 
     def cinder_list(self):
         volumes = self.volume_client.volumes.list()
-        self.assertTrue(self.volume in volumes)
+        self.assertIn(self.volume, volumes)
 
     def cinder_show(self):
         volume = self.volume_client.volumes.get(self.volume.id)