# To access a secure environment additional parameters are needed on the constructor which are listed below
CONFIG = configparser.RawConfigParser()
CONFIG.read('./ibm_whcs_sdk/insights_for_medical_literature/tests/config.ini')

BASE_URL = CONFIG.get('settings', 'base_url')
APIKEY = CONFIG.get('settings', 'key')
IAMURL = CONFIG.get('settings', 'iam_URL')
LEVEL = CONFIG.get('settings', 'logging_level')
VERSION = CONFIG.get('settings', 'version')
DISABLE_SSL = CONFIG.get('settings', 'disable_ssl')
CORPUS = CONFIG.get('settings', 'corpus')
CUI = CONFIG.get('search', 'search_cui')
ONTOLOGY = CONFIG.get('search', 'umls')

IML_TEST = wh.InsightsForMedicalLiteratureServiceV1(
    authenticator=IAMAuthenticator(apikey=APIKEY, url=IAMURL, disable_ssl_verification=DISABLE_SSL),
    version=VERSION
    )
IML_TEST.set_service_url(BASE_URL)

def test_get_from_name_identifier():
    response = IML_TEST.get_cui_info(CORPUS, CUI)
    concept_info = wh.ConceptInfoModel._from_dict(response.get_result())
    assert concept_info is not None
    assert concept_info.cui == CUI
    assert concept_info.ontology is not None
    assert concept_info.preferred_name is not None

def test_get_with_ontology():
    response = IML_TEST.get_cui_info(CORPUS, CUI, ontology=ONTOLOGY, fields='semanticTypes')
    concept_info = wh.ConceptInfoModel._from_dict(response.get_result())
    assert concept_info is not None
import configparser
import ibm_whcs_sdk.insights_for_medical_literature as wh
from ibm_cloud_sdk_core.authenticators.no_auth_authenticator import NoAuthAuthenticator

CONFIG = configparser.RawConfigParser()
CONFIG.read('./ibm_whcs_sdk/insights_for_medical_literature/tests/config.ini')

BASE_URL = CONFIG.get('settings', 'base_url')
APIKEY = CONFIG.get('settings', 'key')
IAMURL = CONFIG.get('settings', 'iam_URL')
LEVEL = CONFIG.get('settings', 'logging_level')
VERSION = CONFIG.get('settings', 'version')
DISABLE_SSL = CONFIG.get('settings', 'disable_ssl')
CORPUS = CONFIG.get('custom', 'custom_corpus')

IML_TEST = wh.InsightsForMedicalLiteratureServiceV1(
    authenticator=NoAuthAuthenticator(), version=VERSION)
IML_TEST.set_service_url(BASE_URL)


# test can only be successful against a custom plan intance
def test_add_document():
    document = {}
    document['title'] = 'test'
    document['abstract'] = 'test'
    document['doc_id'] = 'test'
    document['authors'] = ['test']
    document['publishDate'] = 'test'

    annotators = []
    try:
        IML_TEST.add_corpus_document(corpus=CORPUS,