start_vent_collector void test
@@ -23,38 +23,35 @@ import pytest
from poseidon.baseClasses.Logger_Base import Logger
from poseidon.poseidonMonitor.poseidonMonitor import Monitor
+from poseidon.poseidonMonitor import poseidonMonitor
module_logger = Logger.logger
-def test_signal_handler():
- class MockRabbitConnection:
- connection_closed = False
- def close(self):
- self.connection_closed = True
- return True
+def test_start_vent_collector():
+ class requests():
+ @staticmethod
+ def post(uri, json):
+ mock_response = lambda: None
+ mock_response.text = "success"
+ return mock_response
+
+ poseidonMonitor.CTRL_C = False
+ poseidonMonitor.requests = requests()
class MockMonitor(Monitor):
+ mod_configuration = {
+ 'collector_nic': 2,
+ 'vent_ip': '0.0.0.0',
+ 'vent_port': '8080',
+ }
+
# no need to init the monitor
def __init__(self):
pass
- class MockScheduele:
-
- call_log = []
-
- def __init__(self):
- self.jobs = ['job1', 'job2', 'job3']
-
- def cancel_job(self, job):
- self.call_log.append(job + ' cancelled')
- return job + ' cancelled'
-
mock_monitor = MockMonitor()
- mock_monitor.schedule = MockScheduele()
- mock_monitor.rabbit_channel_connection_local = MockRabbitConnection()
mock_monitor.logger = module_logger
- # signal handler seem to simply exit and kill all the jobs no matter what we pass
- mock_monitor.signal_handler(None, None)
- assert ['job1 cancelled','job2 cancelled','job3 cancelled'] == mock_monitor.schedule.call_log
- assert True == mock_monitor.rabbit_channel_connection_local.connection_closed
+ dev_hash = 'test'
+ num_cuptures = 3
+ mock_monitor.start_vent_collector(dev_hash, num_cuptures)
\ No newline at end of file
