def test_select_more_than_one_domain(core_session, domain_setup, cleanup_resources, clean_up_collections): """ TC:C2215 Select more than one domains. :param core_session: Returns API session. :param domain_setup: Fixture for domain creation. :param cleanup_resources: cleaner for domain. """ # Creating a parent domain. parent_domain_id, domain_info = domain_setup set_list = clean_up_collections # Create a child domain. child_domain_name = f"{'child'}{guid()}" domain_cleanup_list = cleanup_resources[1] new_child_domain_id, add_child_domain_success = ResourceManager.add_child_domain(core_session, child_domain_name, description='test_child_domain', parent_id=parent_domain_id) assert add_child_domain_success, f'Failed to create child domain:API response result:{new_child_domain_id}' logger.info(f"Successfully created child domain:API response result: {new_child_domain_id}") domain_cleanup_list.append(new_child_domain_id) Result, success = ResourceManager.get_administrative_account(core_session, "administrator") logger.info(f" Successfully get Domain for adding Administrative account.") assert success, f'Failed to get Domain account {Result}' # set name created with guid and add it in the domain set set_name = f'set_name{guid()}' add_success, add_result = SetsManager.create_manual_collection(core_session, set_name, "VaultDomain", object_ids=[parent_domain_id]) assert add_success, f'Failed to create set and addition of member to set as: {add_result}' logger.info(f'Successfully created set with member:{add_result}') # cleanup the set and account set_list.append(add_result)
def test_domain_action_try_to_delete_parent_domain(core_session, domain_setup, cleanup_resources, core_admin_ui): """ TC:C2112 Check domain's "Actions" when try to delete the parent domain"". :param core_session: Returns API session. :param domain_setup: Fixture for domain creation. :param cleanup_resources: cleaner for domain. :param core_admin_ui: Return browser session. """ # Creating a parent domain. parent_domain_id, domain_info = domain_setup parent_domain_name = domain_info[0] # Create a child domain. child_domain_name = f"{'child'}{guid()}" domain_cleanup_list = cleanup_resources[1] new_child_domain_id, add_child_domain_success = ResourceManager.add_child_domain( core_session, child_domain_name, description='test_child_domain', parent_id=parent_domain_id) assert add_child_domain_success, f'Failed to create child domain:API response result:{new_child_domain_id}' logger.info( f"Successfully created child domain:API response result: {new_child_domain_id}" ) domain_cleanup_list.append(new_child_domain_id) # Trying to delete parent domain without deleting a child,expecting a failure. failed_del_domain_result, failed_del_domain_success = ResourceManager.del_domain( core_session, parent_domain_id) assert failed_del_domain_success is False, f'Could able to delete domain:API response ' \ f'result: {failed_del_domain_result} ' logger.info( f"Successfully found error message Unable to delete the domain." f"Domain has child domains {failed_del_domain_result}") # UI Launch ui = core_admin_ui ui.navigate('Resources', 'Domains') ui.switch_context(RenderedTab('Domains')) ui.check_span(parent_domain_name) ui.check_span(child_domain_name) ui.check_actions(["Set Administrative Account", "Add To Set"]) logger.info( 'Successfully find "Set Administrative Account" & "Add To Set" in Actions Menu.' )
def test_delete_parent_domain_no_effect_child_domain(core_session, domain_setup): """ TC:C2216 Delete parent domain no effect child domain. :param core_session: Returns API session. :param domain_setup: fixture for creating domain. """ # Creating a parent domain. parent_domain_id, domain_info = domain_setup # Create a child domain. child_domain_name = f"{'R1F1C1'}{guid()}" new_child_domain_id, add_child_domain_success = ResourceManager.add_child_domain( core_session, child_domain_name, description='test_child_domain', parent_id=parent_domain_id) assert add_child_domain_success, f'Failed to create child domain:API response result:{new_child_domain_id}' logger.info(f"Successfully created child domain:{new_child_domain_id}") # Trying to delete parent domain without deleting a child,expecting a failure. failed_del_domain_result, failed_del_domain_success = ResourceManager.del_domain( core_session, parent_domain_id) assert failed_del_domain_success is False, f'Could able to delete parent domain:API response ' \ f'result: {failed_del_domain_result} ' logger.info( f"Could not able to delete parent domain without deleting a child:{failed_del_domain_result}" ) # Trying to delete child domain expecting child domain deleted successfully. child_del_domain_result, child_del_domain_success = ResourceManager.del_domain( core_session, new_child_domain_id) assert child_del_domain_success, f'Fail to delete child domain:API response ' \ f'result: {child_del_domain_result} ' logger.info( f"Successfully deleted child domain: {child_del_domain_result}")