1 # ==================================================================================
2 # Copyright (c) 2020 Nokia
3 # Copyright (c) 2020 AT&T Intellectual Property.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ==================================================================================
18 from rmr.exceptions import InitFailed
19 from ricxappframe.xapp_frame import Xapp
25 def test_bad_gen_xapp():
26 """test that an xapp that does not implement entrypoint blows up"""
32 with pytest.raises(NotImplementedError):
34 bad_xapp = MyXapp(rmr_wait_for_ready=False, use_fake_sdl=True)
39 """test that an xapp whose rmr fails to init blows up"""
45 with pytest.raises(InitFailed):
46 bad_xapp = MyXapp(rmr_port=-1)
47 bad_xapp.run() # we wont get here
50 def test_init_general_xapp():
53 self.sdl_set("testns", "mykey", 6)
56 assert self.sdl_get("testns", "mykey") == 6
57 assert self.sdl_find_and_get("testns", "myk") == {"mykey": 6}
58 assert self.healthcheck()
59 # normally we would have some kind of loop here
63 gen_xapp = MyXapp(rmr_wait_for_ready=False, use_fake_sdl=True)
67 def teardown_module():
71 pytest will never return without this.