Threading pt 1
[ric-plt/a1.git] / tests / conftest.py
index c39b962..73573d0 100644 (file)
@@ -1,8 +1,49 @@
+"""
+pytest conftest
+"""
+# ==================================================================================
+#       Copyright (c) 2019 Nokia
+#       Copyright (c) 2018-2019 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 tempfile
+import os
 import pytest
+from a1 import app
+
+
+@pytest.fixture
+def client():
+    """
+    http://flask.pocoo.org/docs/1.0/testing/
+    """
+
+    db_fd, app.app.config["DATABASE"] = tempfile.mkstemp()
+    app.app.config["TESTING"] = True
+    cl = app.app.test_client()
+
+    yield cl
+
+    os.close(db_fd)
+    os.unlink(app.app.config["DATABASE"])
 
 
 @pytest.fixture
 def adm_type_good():
+    """
+    represents a good put for adm control type
+    """
     return {
         "name": "Admission Control",
         "description": "various parameters to control admission of dual connection",
@@ -41,4 +82,7 @@ def adm_type_good():
 
 @pytest.fixture
 def adm_instance_good():
+    """
+    represents a good put for adm control instance
+    """
     return {"enforce": True, "window_length": 10, "blocking_rate": 20, "trigger_threshold": 10}