X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=near-rt-ric-simulator%2Ftests%2Ftest_std_1_1_3.py;fp=near-rt-ric-simulator%2Ftests%2FSTD_1.1.3%2Ftest_std_1_1_3.py;h=0d2959a6ee7e64b507a4828e59f9d4ea83a60da9;hb=868107297d275a6f50790a5e6d3de6c65cbd4a3e;hp=fc166c9c7bfff878c9970ace47170e753c3afd24;hpb=e9f743a0db7d3a024e868a671f95cbb96cd0632d;p=sim%2Fa1-interface.git diff --git a/near-rt-ric-simulator/tests/STD_1.1.3/test_std_1_1_3.py b/near-rt-ric-simulator/tests/test_std_1_1_3.py similarity index 93% rename from near-rt-ric-simulator/tests/STD_1.1.3/test_std_1_1_3.py rename to near-rt-ric-simulator/tests/test_std_1_1_3.py index fc166c9..0d2959a 100644 --- a/near-rt-ric-simulator/tests/STD_1.1.3/test_std_1_1_3.py +++ b/near-rt-ric-simulator/tests/test_std_1_1_3.py @@ -17,49 +17,19 @@ # This test case test the STD_1.1.3 version of the simulator -import pytest -import sys -import os import json -#Constants for the test case +#Version of simulator INTERFACE_VERSION="STD_1.1.3" -PORT_NUMBER="2224" -HOST_IP="localhost" -SERVER_URL="http://"+HOST_IP+":"+PORT_NUMBER+"/" - -cwd=os.getcwd()+"/" -# Env TESTS_BASE_PATH is set when executed via tox.ini -# If basic test is executed from cmd line, that env var is not needed -if 'TESTS_BASE_PATH' in os.environ: - cwd=os.environ['TESTS_BASE_PATH']+"/"+INTERFACE_VERSION+"/" -TESTDATA=cwd+"/../../test/"+INTERFACE_VERSION+"/jsonfiles/" - -#Env var to setup api version and host logging -os.environ['APIPATH'] = cwd+"/../../api/"+INTERFACE_VERSION -os.environ['REMOTE_HOSTS_LOGGING'] = "ON" - -# Paths need to run the sim, including needed source file dirs -sys.path.append(os.path.abspath(cwd+'../../src/common')) -sys.path.append(os.path.abspath(cwd+'../../test/common')) -sys.path.append(os.path.abspath(cwd+'../../src/'+INTERFACE_VERSION)) -os.chdir(cwd+"../../src/"+INTERFACE_VERSION) - -import main -from main import app -from compare_json import compare -@pytest.fixture -def client(): - with app.app.test_client() as c: - yield c +from unittest_setup import SERVER_URL, HOST_IP, PORT_NUMBER, setup_env, client -def test_apis(client): +#Setup env and import paths +setup_env(INTERFACE_VERSION) - # header for json payload - header = { - "Content-Type" : "application/json" - } +from compare_json import compare + +def test_apis(client): # Simulator hello world response=client.get(SERVER_URL) @@ -99,6 +69,10 @@ def test_apis(client): "priorityLevel": 5 } } + # header for json payload + header = { + "Content-Type" : "application/json" + } response=client.put(SERVER_URL+'A1-P/v1/policies/pi1', headers=header, data=json.dumps(data_pi1)) assert response.status_code == 201 result=json.loads(response.data)