Move registration API to configuration
[pti/o2.git] / tests / conftest.py
index a3359a9..a1655b4 100644 (file)
@@ -14,12 +14,15 @@ from sqlalchemy.orm import sessionmaker, clear_mappers
 from tenacity import retry, stop_after_delay\r
 from unittest.mock import MagicMock\r
 \r
-from o2ims import config\r
+from o2common.config import config\r
+\r
 from o2ims.adapter.orm import metadata, start_o2ims_mappers\r
-from o2ims.adapter.clients.orm_stx import start_o2ims_stx_mappers\r
-from o2ims.adapter import unit_of_work\r
-from o2ims.views.ocloud_route import configure_namespace\r
-from o2ims.bootstrap import bootstrap\r
+# from o2ims.adapter.clients.orm_stx import start_o2ims_stx_mappers\r
+\r
+from o2app.adapter import unit_of_work\r
+from o2ims.views import configure_namespace\r
+\r
+from o2app.bootstrap import bootstrap\r
 \r
 \r
 @pytest.fixture\r
@@ -33,12 +36,11 @@ def mock_uow():
 def mock_flask_uow(mock_uow):\r
     session, uow = mock_uow\r
     app = Flask(__name__)\r
-    app.config["TESTING"] = True\r
+    app.config["TESTING"] = True\r
     api = Api(app)\r
-    bus = bootstrap(False, uow)\r
-    configure_namespace(api, bus)\r
-    client = app.test_client()\r
-    return session, client\r
+    bootstrap(False, uow)\r
+    configure_namespace(api)\r
+    return session, app\r
 \r
 \r
 @pytest.fixture\r
@@ -71,17 +73,17 @@ def sqlite_uow(sqlite_session_factory):
 @pytest.fixture\r
 def sqlite_flask_uow(sqlite_uow):\r
     app = Flask(__name__)\r
-    app.config["TESTING"] = True\r
+    app.config["TESTING"] = True\r
     api = Api(app)\r
-    bus = bootstrap(False, sqlite_uow)\r
-    configure_namespace(api, bus)\r
-    yield app.test_client()\r
+    bootstrap(False, sqlite_uow)\r
+    configure_namespace(api)\r
+    yield sqlite_uow, app\r
 \r
 \r
 @pytest.fixture\r
 def mappers():\r
     start_o2ims_mappers()\r
-    start_o2ims_stx_mappers()\r
+    start_o2ims_stx_mappers()\r
     yield\r
     clear_mappers()\r
 \r
@@ -131,10 +133,11 @@ def postgres_uow(postgres_session_factory):
 @pytest.fixture\r
 def postgres_flask_uow(postgres_uow):\r
     app = Flask(__name__)\r
+    app.config["TESTING"] = True\r
     api = Api(app)\r
-    bus = bootstrap(False, postgres_uow)\r
-    configure_namespace(api, bus)\r
-    yield app.test_client()\r
+    bootstrap(False, postgres_uow)\r
+    configure_namespace(api)\r
+    yield postgres_uow, app\r
 \r
 \r
 @pytest.fixture\r