Changes to framework usage:

    * rather than subclass instantiation, xapps now use initialization and registration functions to register handlers
    * rmr xapps can now register handlers for specific message types (and they must prodive a default callback); if the user does this then "message to function routing" is now handled by the framework itself
    * RMRXapp now runs the polling loop in a thread, and returns execution back to the caller. The user is then free to loop, or do nothing, and call stop() when they want.
    * Raises tox coverage minimum to 70 from 50 (currently at 86)

Issue-ID: RIC-228
Change-Id: I15bfb708dbd14a46dc1207296e77383642d22b29
Signed-off-by: Tommy Carpenter <tc677g@att.com>
diff --git a/tests/test_init.py b/tests/test_init.py
new file mode 100644
index 0000000..1e05455
--- /dev/null
+++ b/tests/test_init.py
@@ -0,0 +1,62 @@
+# ==================================================================================
+#       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 time
+import pytest
+from rmr.exceptions import InitFailed
+from ricxappframe.xapp_frame import Xapp, RMRXapp
+
+
+def test_bad_init():
+    """test that an xapp whose rmr fails to init blows up"""
+
+    def entry(self):
+        pass
+
+    with pytest.raises(InitFailed):
+        bad_xapp = Xapp(entrypoint=entry, rmr_port=-1)
+        bad_xapp.run()  # we wont get here
+
+    def defh(self):
+        pass
+
+    with pytest.raises(InitFailed):
+        bad_xapp = RMRXapp(default_handler=defh, rmr_port=-1)
+        bad_xapp.run()  # we wont get here
+
+
+def test_init_general_xapp():
+    def entry(self):
+        # normally we would have some kind of loop here
+        print("bye")
+
+    gen_xapp = Xapp(entrypoint=entry, rmr_wait_for_ready=False, use_fake_sdl=True)
+    gen_xapp.run()
+    time.sleep(1)
+    gen_xapp.stop()  # pytest will never return without this.
+
+
+def test_init_rmr_xapp():
+    def post_init(self):
+        print("hey")
+
+    def foo(self, _summary, _sbuf):
+        pass
+
+    rmr_xapp = RMRXapp(foo, post_init=post_init, rmr_wait_for_ready=False, use_fake_sdl=True)
+    rmr_xapp.run()
+    time.sleep(1)
+    rmr_xapp.stop()  # pytest will never return without this.