aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSatoshi Fujii <fujii-satoshi@jp.fujitsu.com>2021-06-15 13:33:50 +0000
committerSatoshi Fujii <fujii-satoshi@jp.fujitsu.com>2021-06-18 07:40:46 +0000
commit313750bef0318c2204ce869fb2bdc4d4043a20e6 (patch)
treec7d4045cce3fe7a47284e20d97c6d47830238d22 /tests
parentd39331be3f55876a8a6fc31c5a10f2d68eefe0b0 (diff)
Remove unused code
Just remove unused code Signed-off-by: Satoshi Fujii <fujii-satoshi@jp.fujitsu.com> Issue-ID: DCAEGEN2-2833 Change-Id: If81a5fcb918a2683e261807d6a3da5a8648e505d
Diffstat (limited to 'tests')
-rw-r--r--tests/test_binding.py17
-rw-r--r--tests/test_trapd_exit.py6
-rw-r--r--tests/test_trapd_get_cbs_config.py29
-rw-r--r--tests/test_trapd_http_session.py4
-rw-r--r--tests/test_trapd_runtime_pid.py4
-rw-r--r--tests/test_trapd_settings.py4
-rw-r--r--tests/test_trapd_vnf_table.py3
7 files changed, 0 insertions, 67 deletions
diff --git a/tests/test_binding.py b/tests/test_binding.py
index 82e9f7f..010c63d 100644
--- a/tests/test_binding.py
+++ b/tests/test_binding.py
@@ -28,14 +28,12 @@ MODULE_EXTENSIONS = ('.py', '.pyc', '.pyo')
# MONKEYPATCHES
#####
-#mr_url = 'http://127.0.0.1:3904'
mr_url = 'http://mrrouter.onap.org:3904'
intopic = 'VESCOLL-VNFNJ-SECHEARTBEAT-OUTPUT'
outopic = 'POLICY-HILOTCA-EVENT-OUTPUT'
@httpretty.activate
def test_resolve_all():
- #htbtmsg = "Find the best daily deals"
htbtmsg = '{"event":{"commonEventHeader":{"startEpochMicrosec":1518616063564475,"sourceId":"587c14b3-72c0-4581-b5cb-6567310b9bb7","eventId":"10048640","reportingEntityId":"587c14b3-72c0-4581-b5cb-6567310b9bb7","priority":"Normal","version":3,"reportingEntityName":"TESTVM","sequence":10048640,"domain":"heartbeat","lastEpochMicrosec":1518616063564476,"eventName":"Heartbeat_vVnf","sourceName":"TESTVM","nfNamingCode":"vVNF"}}}'
send_url = mr_url+'/events/'+intopic+'/DefaultGroup/1?timeout=15000'
print(send_url)
@@ -53,21 +51,6 @@ def test_resolve_all():
pol_body = json.dumps({"event":{"commonEventHeader":{"startEpochMicrosec":1518616063564475,"sourceId":"587c14b3-72c0-4581-b5cb-6567310b9bb7","eventId":"10048640","reportingEntityId":"587c14b3-72c0-4581-b5cb-6567310b9bb7","priority":"Normal","version":3,"reportingEntityName":"TESTVM","sequence":10048640,"domain":"heartbeat","lastEpochMicrosec":1518616063564476,"eventName":"Heartbeat_vVnf","sourceName":"TESTVM","nfNamingCode":"vVNF"}}})
print("Policy URL : "+pol_url)
httpretty.register_uri(httpretty.POST, pol_url, body=pol_body, status=200, content_type='text/json')
- #misshtbtd.main()
- #ret = htbtworker.periodic_event()
- #print("Returned",ret)
- #assert(ret == 1)
def test_full():
p = subprocess.Popen(['./miss_htbt_service/misshtbtd.py'], stdout=subprocess.PIPE,shell=True)
- #time.sleep(30)
- #r = requests.get('http://localhost:10002')
- #print(r.status_code)
- #assert(r.status_code == 200)
- #r = requests.post('http://127.0.0.1:10002',data={'number': '12524', 'health': 'good', 'action': 'show'})
- #r = requests.post('http://localhost:10002',data={'number': '12524', 'health': 'good', 'action': 'show'})
- #print(r.status_code)
- #assert(r.status_code == 200)
-
-#def test_conifg_notif():
- #config_notif.config_notif_run()
diff --git a/tests/test_trapd_exit.py b/tests/test_trapd_exit.py
index 93e8f9a..35b7111 100644
--- a/tests/test_trapd_exit.py
+++ b/tests/test_trapd_exit.py
@@ -39,9 +39,6 @@ class test_cleanup_and_exit(unittest.TestCase):
assert pytest_wrapped_sys_exit.type == SystemExit
assert pytest_wrapped_sys_exit.value.code == 0
- # compare = str(result).startswith("SystemExit: 0")
- # self.assertEqual(compare, True)
-
def test_abnormal_exit(self):
"""
Test exit with missing PID file exits non-zero
@@ -50,6 +47,3 @@ class test_cleanup_and_exit(unittest.TestCase):
result = trapd_exit.cleanup_and_exit(0,pid_file_dne)
assert pytest_wrapped_sys_exit.type == SystemExit
assert pytest_wrapped_sys_exit.value.code == 1
-
-#if __name__ == '__main__':
-# unittest.main()
diff --git a/tests/test_trapd_get_cbs_config.py b/tests/test_trapd_get_cbs_config.py
index ea859af..6cebef2 100644
--- a/tests/test_trapd_get_cbs_config.py
+++ b/tests/test_trapd_get_cbs_config.py
@@ -29,7 +29,6 @@ class test_get_cbs_config(unittest.TestCase):
pytest_json_data ="{ \"heartbeat_config\": { \"vnfs\": [{ \"eventName\": \"Heartbeat_vDNS\", \"heartbeatcountmissed\": 3, \"heartbeatinterval\": 60, \"closedLoopControlName\": \"ControlLoopEvent1\", \"policyVersion\": \"1.0.0.5\", \"policyName\": \"vFireWall\", \"policyScope\": \"resource=sampleResource,type=sampletype,CLName=sampleCLName\", \"target_type\": \"VNF\", \"target\": \"genVnfName\", \"version\": \"1.0\" }, { \"eventName\": \"Heartbeat_vFW\", \"heartbeatcountmissed\": 3, \"heartbeatinterval\": 60, \"closedLoopControlName\": \"ControlLoopEvent1\", \"policyVersion\": \"1.0.0.5\", \"policyName\": \"vFireWall\", \"policyScope\": \"resource=sampleResource,type=sampletype,CLName=sampleCLName\", \"target_type\": \"VNF\", \"target\": \"genVnfName\", \"version\": \"1.0\" }, { \"eventName\": \"Heartbeat_xx\", \"heartbeatcountmissed\": 3, \"heartbeatinterval\": 60, \"closedLoopControlName\": \"ControlLoopEvent1\", \"policyVersion\": \"1.0.0.5\", \"policyName\": \"vFireWall\", \"policyScope\": \"resource=sampleResource,type=sampletype,CLName=sampleCLName\", \"target_type\": \"VNF\", \"target\": \"genVnfName\", \"version\": \"1.0\" } ] }, \"streams_publishes\": { \"ves_heartbeat\": { \"dmaap_info\": { \"topic_url\": \"http://message-router:3904/events/unauthenticated.DCAE_CL_OUTPUT/\" }, \"type\": \"message_router\" } }, \"streams_subscribes\": { \"ves_heartbeat\": { \"dmaap_info\": { \"topic_url\": \"http://message-router:3904/events/unauthenticated.SEC_HEARTBEAT_INPUT/\" }, \"type\": \"message_router\" } } }"
-
# create copy of snmptrapd.json for pytest
pytest_json_config = "/tmp/opt/app/miss_htbt_service/etc/config.json"
with open(pytest_json_config, 'w') as outfile:
@@ -41,32 +40,10 @@ class test_get_cbs_config(unittest.TestCase):
Test that CONSUL_HOST env variable exists but fails to
respond
"""
- #os.environ.update(CONSUL_HOST='nosuchhost')
- #del os.environ['CBS_HTBT_JSON']
- #result = trapd_get_cbs_config.get_cbs_config()
- #print("result: %s" % result)
- #compare = str(result).startswith("{'snmptrap': ")
- #self.assertEqual(compare, False)
with pytest.raises(Exception) as pytest_wrapped_sys_exit:
result = trapd_get_cbs_config.get_cbs_config()
assert pytest_wrapped_sys_exit.type == SystemExit
- # assert pytest_wrapped_sys_exit.value.code == 1
-
-
-# def test_cbs_override_env_invalid(self):
-# """
-# """
-# #os.environ.update(CBS_HTBT_JSON='/tmp/opt/app/miss_htbt_service/etc/nosuchfile.json')
-# #result = trapd_get_cbs_config.get_cbs_config()
-# #print("result: %s" % result)
-# #compare = str(result).startswith("{'snmptrap': ")
-# #self.assertEqual(compare, False)
-#
-# with pytest.raises(SystemExit) as pytest_wrapped_sys_exit:
-# result = trapd_get_cbs_config.get_cbs_config()
-# assert pytest_wrapped_sys_exit.type == SystemExit
-# assert pytest_wrapped_sys_exit.value.code == 1
def test_cbs_fallback_env_present(self):
@@ -75,12 +52,6 @@ class test_get_cbs_config(unittest.TestCase):
from fallback env var
"""
os.environ.update(CBS_HTBT_JSON='/tmp/opt/app/miss_htbt_service/etc/config.json')
- #result = trapd_get_cbs_config.get_cbs_config()
result = True
print("result: %s" % result)
- # compare = str(result).startswith("{'snmptrap': ")
- # self.assertEqual(compare, True)
self.assertEqual(result, True)
-
-#if __name__ == '__main__':
-# unittest.main()
diff --git a/tests/test_trapd_http_session.py b/tests/test_trapd_http_session.py
index d36ced0..47380fc 100644
--- a/tests/test_trapd_http_session.py
+++ b/tests/test_trapd_http_session.py
@@ -31,7 +31,3 @@ class test_init_session_obj(unittest.TestCase):
result = trapd_http_session.init_session_obj()
compare = str(result).startswith("<requests.sessions.Session object at")
self.assertEqual(compare, True)
-
-
-#if __name__ == '__main__':
-# unittest.main()
diff --git a/tests/test_trapd_runtime_pid.py b/tests/test_trapd_runtime_pid.py
index d03e246..f31c4db 100644
--- a/tests/test_trapd_runtime_pid.py
+++ b/tests/test_trapd_runtime_pid.py
@@ -59,7 +59,3 @@ class test_rm_pid(unittest.TestCase):
"""
result = trapd_runtime_pid.rm_pid('/tmp/snmptrap_test_pid_file_9999')
self.assertEqual(result, False)
-
-
-#if __name__ == '__main__':
-# unittest.main()
diff --git a/tests/test_trapd_settings.py b/tests/test_trapd_settings.py
index 5d6cd0d..d800119 100644
--- a/tests/test_trapd_settings.py
+++ b/tests/test_trapd_settings.py
@@ -80,7 +80,3 @@ class test_cleanup_and_exit(unittest.TestCase):
except:
result = False
self.assertEqual(result, True)
-
-#if __name__ == '__main__':
- # tds.init()
-# unittest.main()
diff --git a/tests/test_trapd_vnf_table.py b/tests/test_trapd_vnf_table.py
index 3d1d34b..f89aa6a 100644
--- a/tests/test_trapd_vnf_table.py
+++ b/tests/test_trapd_vnf_table.py
@@ -104,6 +104,3 @@ class test_vnf_tables(unittest.TestCase):
result= verify_sendControlLoop_VM_ABATED()
_logger.info(result)
self.assertEqual(result, True)
-
-#if __name__ == '__main__':
-# unittest.main()