mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 10:04:33 +02:00
fixed tests
This commit is contained in:
parent
b70a209899
commit
cd4ccd5cf7
|
@ -40,7 +40,7 @@ class ScheduleManager:
|
|||
# wait some time
|
||||
threading.Event().wait(timeout=10)
|
||||
|
||||
# get actual modem istamce
|
||||
# get actual modem instance
|
||||
self.modem = modem
|
||||
|
||||
self.running = True # Set the running flag to True
|
||||
|
@ -59,11 +59,11 @@ class ScheduleManager:
|
|||
for event in list(self.scheduler.queue):
|
||||
self.scheduler.cancel(event)
|
||||
# Wait for the scheduler thread to finish
|
||||
self.scheduler_thread.join()
|
||||
if self.scheduler_thread:
|
||||
self.scheduler_thread.join()
|
||||
|
||||
def transmit_beacon(self):
|
||||
if not self.state_manager.getARQ() and self.state_manager.is_beacon_running:
|
||||
|
||||
cmd = command_beacon.BeaconCommand(self.config, self.state_manager, self.event_manager)
|
||||
cmd.run(self.event_manager, self.modem)
|
||||
|
||||
|
@ -73,7 +73,6 @@ class ScheduleManager:
|
|||
explorer.explorer(self.modem_version, self.config_manager, self.state_manager).push()
|
||||
|
||||
def check_for_queued_messages(self):
|
||||
|
||||
if not self.state_manager.getARQ():
|
||||
if DatabaseManager(self.event_manager).get_first_queued_message():
|
||||
params = DatabaseManager(self.event_manager).get_first_queued_message()
|
||||
|
|
|
@ -5,15 +5,17 @@ import unittest
|
|||
import queue
|
||||
from arq_data_type_handler import ARQDataTypeHandler, ARQ_SESSION_TYPES
|
||||
from event_manager import EventManager
|
||||
|
||||
from state_manager import StateManager
|
||||
|
||||
class TestDispatcher(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.event_queue = queue.Queue()
|
||||
cls.state_queue = queue.Queue()
|
||||
cls.event_manager = EventManager([cls.event_queue])
|
||||
cls.arq_data_type_handler = ARQDataTypeHandler(cls.event_manager)
|
||||
cls.state_manager = StateManager([cls.state_queue])
|
||||
cls.arq_data_type_handler = ARQDataTypeHandler(cls.event_manager, cls.state_manager)
|
||||
|
||||
|
||||
def testDataTypeHevent_managerandlerRaw(self):
|
||||
|
|
|
@ -28,7 +28,7 @@ class TestDataFrameFactory(unittest.TestCase):
|
|||
'type': 'image/gif',
|
||||
'data': str(base64.b64encode(np.random.bytes(1024)), 'utf-8')
|
||||
}
|
||||
apiParams = {'dxcall': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
apiParams = {'destination': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
message = MessageP2P.from_api_params(self.mycall, apiParams)
|
||||
payload = message.to_payload()
|
||||
received_message = MessageP2P.from_payload(payload)
|
||||
|
@ -44,7 +44,7 @@ class TestDataFrameFactory(unittest.TestCase):
|
|||
'type': 'image/gif',
|
||||
'data': str(base64.b64encode(np.random.bytes(1024)), 'utf-8')
|
||||
}
|
||||
apiParams = {'dxcall': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
apiParams = {'destination': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
message = MessageP2P.from_api_params(self.mycall, apiParams)
|
||||
payload = message.to_payload()
|
||||
received_message = MessageP2P.from_payload(payload)
|
||||
|
@ -65,7 +65,7 @@ class TestDataFrameFactory(unittest.TestCase):
|
|||
'data': str(base64.b64encode(np.random.bytes(1024)), 'utf-8')
|
||||
}
|
||||
|
||||
apiParams = {'dxcall': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
apiParams = {'destination': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
message = MessageP2P.from_api_params(self.mycall, apiParams)
|
||||
payload = message.to_payload()
|
||||
received_message = MessageP2P.from_payload(payload)
|
||||
|
@ -92,7 +92,7 @@ class TestDataFrameFactory(unittest.TestCase):
|
|||
'type': 'image/gif',
|
||||
'data': str(base64.b64encode(np.random.bytes(1024)), 'utf-8')
|
||||
}
|
||||
apiParams = {'dxcall': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment1, attachment2, attachment3]}
|
||||
apiParams = {'destination': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment1, attachment2, attachment3]}
|
||||
message = MessageP2P.from_api_params(self.mycall, apiParams)
|
||||
payload = message.to_payload()
|
||||
received_message = MessageP2P.from_payload(payload)
|
||||
|
|
|
@ -24,11 +24,11 @@ class TestDataFrameFactory(unittest.TestCase):
|
|||
|
||||
def testFromApiParams(self):
|
||||
api_params = {
|
||||
'dxcall': 'DJ2LS-3',
|
||||
'destination': 'DJ2LS-3',
|
||||
'body': 'Hello World!',
|
||||
}
|
||||
message = MessageP2P.from_api_params(self.mycall, api_params)
|
||||
self.assertEqual(message.destination, api_params['dxcall'])
|
||||
self.assertEqual(message.destination, api_params['destination'])
|
||||
self.assertEqual(message.body, api_params['body'])
|
||||
|
||||
def testToPayloadWithAttachment(self):
|
||||
|
@ -37,7 +37,7 @@ class TestDataFrameFactory(unittest.TestCase):
|
|||
'type': 'image/gif',
|
||||
'data': str(base64.b64encode(np.random.bytes(1024)), 'utf-8')
|
||||
}
|
||||
apiParams = {'dxcall': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
apiParams = {'destination': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
message = MessageP2P.from_api_params(self.mycall, apiParams)
|
||||
|
||||
payload = message.to_payload()
|
||||
|
@ -54,7 +54,7 @@ class TestDataFrameFactory(unittest.TestCase):
|
|||
'type': 'image/gif',
|
||||
'data': str(base64.b64encode(np.random.bytes(1024)), 'utf-8')
|
||||
}
|
||||
apiParams = {'dxcall': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
apiParams = {'destination': 'DJ2LS-3', 'body': 'Hello World!', 'attachments': [attachment]}
|
||||
message = MessageP2P.from_api_params(self.mycall, apiParams)
|
||||
|
||||
payload = message.to_payload()
|
||||
|
|
Loading…
Reference in a new issue