Release 1.0.1
[ric-app/ad.git] / tests / test_ad.py
index c60c9dc..cb0a73a 100644 (file)
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 # ==================================================================================
-from ad import main
+import json
+from src import main
 from ricxappframe.xapp_frame import Xapp
 from contextlib import suppress
-import os
-from ad.ad_train import train
-import json
 
 
-def test_RFtrainmodel(monkeypatch):
-    if not os.path.isfile('ad/RF'):
-        train()
+def test_database_connection(monkeypatch):
+    # start ad
+    main.connectdb(thread=True)
+
+
+def test_trainModel(monkeypatch):
+    main.train_model()
 
 
-def test_predict_anomaly(monkeypatch):
-    main.predict_anomaly('test')
+def test_predict_anomaly(monkeypatch, ad_ue):
+    main.load_model()
+    main.predict_anomaly(monkeypatch, ad_ue)
 
 
 def test_msg_to_ts(monkeypatch, ad_to_ts):