def _check_volume_transfer_presence(): try: self._client.get(transfer.id) is_present = True except exceptions.NotFound: is_present = False return expect_that(is_present, equal_to(must_present))
def is_old_host_volume_absent(): page_volumes.refresh() page_volumes.label_volumes.click() return expect_that( page_volumes.tab_volumes.table_volumes.row( name=volume_name, host=old_host).is_present, equal_to(False))
def _check_snapshots_presence(): # Make a dict with actual presence values for each snapshot actual_presence = dict.fromkeys(snapshot_ids, False) for snapshot in self._client.list(): if snapshot.id in actual_presence: actual_presence[snapshot.id] = True return expect_that(actual_presence, equal_to(expected_presence))
def _check_agents_alive(): agents = [ agent for agent in self.get_agents() if agent['id'] in agents_ids ] return expect_that(agents, only_contains(has_entries(alive=must_alive)))
def _check_backup_presence(): try: self._client.get(backup.id) is_present = True except exceptions.NotFound: is_present = False return expect_that(is_present, equal_to(must_present))
def _check_image_presence(): try: self._client.images.get(image.id) is_present = True except exc.NotFound: is_present = False return expect_that(is_present, equal_to(must_present))
def _check_presence(): try: get_stack() is_present = True except exc.NotFound: is_present = False return expect_that(is_present, equal_to(must_present))
def _check_user_in_group(): try: user_is_in_group = self._client.check_in_group(user=user, group=group) except exceptions.NotFound: user_is_in_group = False return expect_that(user_is_in_group, equal_to(must_present))
def _check_flavor_presence(): try: # After deleting flavor `get` method still return object, # so it was changed to find self._client.find(id=flavor.id) is_present = True except exceptions.NotFound: is_present = False return expect_that(is_present, equal_to(must_present))
def predicate(): try: self.get_token_validate(token) is_revoked = True except exceptions.NotFound: is_revoked = False return expect_that(is_revoked, equal_to(must_revoked))
def check_rows(): for row in page_instances.table_instances.rows: if not (row.is_present and query in row.link_instance.value): is_present = False break is_present = True return expect_that(is_present, equal_to(True))
def _check_image_bind_status(): members = self._client.image_members.list(image.id) member_ids = [member['member_id'] for member in members] if must_bound: assert_that(project.id, is_in(member_ids)) is_bound = True else: is_bound = False return expect_that(is_bound, equal_to(must_bound))
def _check_chassis_presence(): actual_presence = {} for chassis in chassis_list: try: self._client.get(chassis.uuid) actual_presence[chassis.uuid] = True except exceptions.NotFound: actual_presence[chassis.uuid] = False return expect_that(actual_presence, equal_to(expected_presence))
def _check_ironic_nodes_presence(): actual_presence = {} for node in nodes: try: self._client.node.get(node.uuid) actual_presence[node.uuid] = True except exceptions.NotFound: actual_presence[node.uuid] = False return expect_that(actual_presence, equal_to(expected_presence))
def _check_keypairs_presence(): actual_presence = {} for keypair in keypairs: try: keypair.get() actual_presence[keypair.id] = True except nova_exceptions.NotFound: actual_presence[keypair.id] = False return expect_that(actual_presence, equal_to(expected_presence))
def _check_role_grant_status(): try: self._client.check(role, user=user, group=group, domain=domain, project=project) is_granted = True except exceptions.NotFound: is_granted = False return expect_that(is_granted, equal_to(must_granted))
def _is_rc_file_downloaded(): try: if (os.path.basename(self._rc_path) in os.listdir(self.app.download_dir)): with open(self._rc_path) as f: is_downloaded = bool(f.read(1)) else: is_downloaded = True except IOError: is_downloaded = False return expect_that(is_downloaded, equal_to(True))
def _check_service_state(): matcher = has_items(*nodes) if not must_run: matcher = is_not(matcher) return expect_that(service.get_nodes(), matcher)
def predicate(): server.get() return expect_that(server.metadata, matcher)
def _check_server_status(): server.get() return expect_that(server.status.lower(), is_not(is_in(transit_statuses)))
def _check_router_presence(): is_present = bool(self._client.find_all(id=router['id'])) return expect_that(is_present, equal_to(must_present))
def _check_interface_subnet_presence(): subnet_ids = self._client.get_interfaces_subnets_ids(router['id']) is_present = subnet['id'] in subnet_ids return expect_that(is_present, equal_to(must_present))
def _check_gateway_presence(): router = self._client.get(router_id) is_present = router['external_gateway_info'] is not None return expect_that(is_present, equal_to(must_present))
def _check_snapshot_status(): snapshot.get() return expect_that(snapshot.status.lower(), equal_to(status.lower()))
def _check_fixed_ip_attached(): server.get() ips_after_attach = self.get_ips(server, 'fixed').keys() return expect_that(len(ips_after_attach), equal_to(len(ips_before_attach) + 1))
def _check_detach_fixed_ip(): server.get() fixed_ips = self.get_ips(server, 'fixed').keys() return expect_that(fixed_ip, is_not(is_in(fixed_ips)))
def _check_backup_status(): backup.get() return expect_that(backup.status.lower(), equal_to(status.lower()))
def _check_image_status(): image.update(self._client.images.get(image.id)) return expect_that(image.status.lower(), equal_to(status.lower()))
def _check_ironic_node_maintenance(): self._get_node(node) return expect_that(node.maintenance, equal_to(state))
def _check_network_presence(): is_present = bool(self._client.find_all(id=network['id'])) return expect_that(is_present, equal_to(must_present))