X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=tests%2Ftest_xapp.py;fp=tests%2Ftest_xapp.py;h=0000000000000000000000000000000000000000;hb=f9cd5cc676355485c2d9c8bc2be22ddad4874382;hp=def7904978ec3a5ac94859048ffd4c5377b03600;hpb=06c2edc43327744be4ef1114fd99edfd111039fa;p=ric-plt%2Fxapp-frame-py.git diff --git a/tests/test_xapp.py b/tests/test_xapp.py deleted file mode 100644 index def7904..0000000 --- a/tests/test_xapp.py +++ /dev/null @@ -1,73 +0,0 @@ -# ================================================================================== -# Copyright (c) 2020 Nokia -# Copyright (c) 2020 AT&T Intellectual Property. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ================================================================================== -import pytest -from rmr.exceptions import InitFailed -from ricxappframe.xapp_frame import Xapp - -gen_xapp = None -rmr_xapp = None - - -def test_bad_gen_xapp(): - """test that an xapp that does not implement entrypoint blows up""" - - class MyXapp(Xapp): - def post_init(self): - pass - - with pytest.raises(NotImplementedError): - # missing entrypoint - bad_xapp = MyXapp(rmr_wait_for_ready=False, use_fake_sdl=True) - bad_xapp.run() - - -def test_bad_init(): - """test that an xapp whose rmr fails to init blows up""" - - class MyXapp(Xapp): - def entrypoint(self): - pass - - with pytest.raises(InitFailed): - bad_xapp = MyXapp(rmr_port=-1) - bad_xapp.run() # we wont get here - - -def test_init_general_xapp(): - class MyXapp(Xapp): - def post_init(self): - self.sdl_set("testns", "mykey", 6) - - def entrypoint(self): - assert self.sdl_get("testns", "mykey") == 6 - assert self.sdl_find_and_get("testns", "myk") == {"mykey": 6} - assert self.healthcheck() - # normally we would have some kind of loop here - print("bye") - - global gen_xapp - gen_xapp = MyXapp(rmr_wait_for_ready=False, use_fake_sdl=True) - gen_xapp.run() - - -def teardown_module(): - """ - module teardown - - pytest will never return without this. - """ - gen_xapp.stop()