summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2020-07-27 10:02:19 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2020-07-31 13:21:08 +0000
commite97a5ce265f7e1d3380fab9c4132e2b002e8636c (patch)
tree416c4c60a339419d06b6ae165b9231c16fa44f45 /tests
parenta9e77b57b3c1f326ddf6f29e2c89765344e53b99 (diff)
Run in Python 3.8
Use image recommended by SECCOM Issue-ID: DCAEGEN2-2292 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: I8d77f150c9fe314bf26bac2c9fac7ebc9782c9d8
Diffstat (limited to 'tests')
-rw-r--r--tests/test_config_notif.py25
-rw-r--r--tests/test_trapd_vnf_table.py11
2 files changed, 19 insertions, 17 deletions
diff --git a/tests/test_config_notif.py b/tests/test_config_notif.py
index b59696e..707717c 100644
--- a/tests/test_config_notif.py
+++ b/tests/test_config_notif.py
@@ -1,5 +1,6 @@
# ============LICENSE_START=======================================================
# Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+# Copyright 2020 Deutsche Telekom. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,10 +15,10 @@
# limitations under the License.
# ============LICENSE_END=========================================================
-from miss_htbt_service import config_notif
+import config_notif
# from miss_htbt_service.mod.trapd_get_cbs_config import get_cbs_config
-import miss_htbt_service.mod.trapd_get_cbs_config
-import miss_htbt_service.mod.trapd_settings
+import mod.trapd_get_cbs_config
+import mod.trapd_settings
from . import monkey_psycopg2
import psycopg2
@@ -204,7 +205,7 @@ def monkeypatch_get_cbs_config_False():
Required side affect: c_config is set to a json value
"""
print("monkeypatch_get_cbs_config_False()")
- miss_htbt_service.mod.trapd_settings.c_config = { "patch": "false" }
+ mod.trapd_settings.c_config = { "patch": "false" }
return False
def monkeypatch_get_cbs_config_True():
@@ -213,14 +214,14 @@ def monkeypatch_get_cbs_config_True():
Required side affect: c_config is set to a json value
"""
print("monkeypatch_get_cbs_config_True()")
- miss_htbt_service.mod.trapd_settings.c_config = { "patch": "true" }
+ mod.trapd_settings.c_config = { "patch": "true" }
return True
def test_fetch_json_file_get_cbs_config_is_true(monkeypatch):
"""
test fetch_json_file() with get_cbs_config() returning True
"""
- monkeypatch.setattr(miss_htbt_service.mod.trapd_get_cbs_config, 'get_cbs_config', monkeypatch_get_cbs_config_True)
+ monkeypatch.setattr(mod.trapd_get_cbs_config, 'get_cbs_config', monkeypatch_get_cbs_config_True)
tmp1 = tempfile.NamedTemporaryFile(mode="w+")
tmp2 = tempfile.NamedTemporaryFile(mode="w+")
output = config_notif.fetch_json_file(download_json = tmp1.name, config_json = tmp2.name)
@@ -234,7 +235,7 @@ def test_fetch_json_file_get_cbs_config_is_false(monkeypatch):
"""
test fetch_json_file() with get_cbs_config() returning False
"""
- monkeypatch.setattr(miss_htbt_service.mod.trapd_get_cbs_config, 'get_cbs_config', monkeypatch_get_cbs_config_False)
+ monkeypatch.setattr(mod.trapd_get_cbs_config, 'get_cbs_config', monkeypatch_get_cbs_config_False)
tmp1 = tempfile.NamedTemporaryFile(mode="w+")
tmp2 = tempfile.NamedTemporaryFile(mode="w+")
output = config_notif.fetch_json_file(download_json = tmp1.name, config_json = tmp2.name)
@@ -263,7 +264,7 @@ def test_config_notif_run_good(monkeypatch):
everything good: "dbname" found (from below JSON info), "hb_common" listed in tables
and hb_common has data.
"""
- monkeypatch.setattr(miss_htbt_service.config_notif, 'fetch_json_file', monkeypatch_fetch_json_file)
+ monkeypatch.setattr(config_notif, 'fetch_json_file', monkeypatch_fetch_json_file)
tmp = tempfile.NamedTemporaryFile(mode="w+")
global FETCH_JSON_FILE
@@ -307,7 +308,7 @@ def test_config_notif_run_fail1(monkeypatch):
Failure case 1: "dbname" NOT found (from below JSON info), "hb_common" listed in tables
and hb_common has data.
"""
- monkeypatch.setattr(miss_htbt_service.config_notif, 'fetch_json_file', monkeypatch_fetch_json_file)
+ monkeypatch.setattr(config_notif, 'fetch_json_file', monkeypatch_fetch_json_file)
tmp = tempfile.NamedTemporaryFile(mode="w+")
global FETCH_JSON_FILE
@@ -351,7 +352,7 @@ def test_config_notif_run_fail2(monkeypatch):
Failure case 2: "dbname" found (from below JSON info), "hb_common" NOT listed in tables
and hb_common has data.
"""
- monkeypatch.setattr(miss_htbt_service.config_notif, 'fetch_json_file', monkeypatch_fetch_json_file)
+ monkeypatch.setattr(config_notif, 'fetch_json_file', monkeypatch_fetch_json_file)
tmp = tempfile.NamedTemporaryFile(mode="w+")
global FETCH_JSON_FILE
@@ -395,8 +396,8 @@ def test_config_notif_run_fail3(monkeypatch):
Failure case 3: "dbname" found (from below JSON info), "hb_common" listed in tables
and update_hb_common() fails
"""
- monkeypatch.setattr(miss_htbt_service.config_notif, 'fetch_json_file', monkeypatch_fetch_json_file)
- monkeypatch.setattr(miss_htbt_service.config_notif, 'update_hb_common', monkeypatch_return_False)
+ monkeypatch.setattr(config_notif, 'fetch_json_file', monkeypatch_fetch_json_file)
+ monkeypatch.setattr(config_notif, 'update_hb_common', monkeypatch_return_False)
tmp = tempfile.NamedTemporaryFile(mode="w+")
global FETCH_JSON_FILE
diff --git a/tests/test_trapd_vnf_table.py b/tests/test_trapd_vnf_table.py
index 4f5cace..d0bf51c 100644
--- a/tests/test_trapd_vnf_table.py
+++ b/tests/test_trapd_vnf_table.py
@@ -3,6 +3,7 @@
# ================================================================================
# Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved.
# Copyright (c) 2019 Pantheon.tech. All rights reserved.
+# Copyright 2020 Deutsche Telekom. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,11 +27,11 @@ import unittest
import sys
import pytest
import logging
-from miss_htbt_service import misshtbtd as db
-from miss_htbt_service import htbtworker as pm
-from miss_htbt_service import db_monitoring as dbmon
-from miss_htbt_service import get_logger
-from miss_htbt_service.mod.trapd_vnf_table import (
+import misshtbtd as db
+import htbtworker as pm
+import db_monitoring as dbmon
+import get_logger
+from mod.trapd_vnf_table import (
verify_DB_creation_1, verify_DB_creation_2, verify_DB_creation_hb_common,
verify_cbsPolling_required, hb_properties, verify_cbspolling,
verify_sendControlLoop_VNF_ONSET, verify_sendControlLoop_VM_ONSET,