1515@patch .multiple (CommunicationMethod , __abstractmethods__ = set ())
1616class TestCommunicationMethod :
1717 def test_communicate (self ):
18- mock_sats = [MagicMock (), MagicMock ()]
18+ mock_sats = [MagicMock (), MagicMock (), MagicMock () ]
1919 mock_sats [0 ].simulator .sim_time = 0.0
2020 comms = CommunicationMethod ()
2121 comms .last_communication_time = 0.0
@@ -34,7 +34,7 @@ def test_communicate(self):
3434 sat .data_store .update_with_communicated_data .assert_called_once ()
3535
3636 def test_min_period_elapsed (self ):
37- mock_sats = [MagicMock (), MagicMock ()]
37+ mock_sats = [MagicMock (), MagicMock (), MagicMock () ]
3838 comms = CommunicationMethod (min_period = 1.0 )
3939 comms .link_satellites (mock_sats )
4040 comms .communication_pairs = MagicMock (
@@ -47,7 +47,7 @@ def test_min_period_elapsed(self):
4747 sat .data_store .update_with_communicated_data .assert_called_once ()
4848
4949 def test_min_period_not_elapsed (self ):
50- mock_sats = [MagicMock (), MagicMock ()]
50+ mock_sats = [MagicMock (), MagicMock (), MagicMock () ]
5151 comms = CommunicationMethod (min_period = 1.0 )
5252 comms .link_satellites (mock_sats )
5353 comms .communication_pairs = MagicMock (
@@ -59,6 +59,29 @@ def test_min_period_not_elapsed(self):
5959 for sat in mock_sats :
6060 sat .data_store .update_with_communicated_data .assert_not_called ()
6161
62+ def test_override_communicate_all (self ):
63+ mock_sats = [MagicMock () for i in range (3 )]
64+ comms = FreeCommunication ()
65+ comms .last_communication_time = 0.0
66+ mock_sats [0 ].simulator .sim_time = 1.0
67+ comms .link_satellites (mock_sats )
68+ comms ._communicate_all = MagicMock ()
69+ comms .communicate ()
70+ comms ._communicate_all .assert_called_once ()
71+
72+ def test_override_communicate_all_nocall (self ):
73+ mock_sats = [MagicMock () for i in range (3 )]
74+ comms = CommunicationMethod ()
75+ comms .communication_pairs = MagicMock (
76+ return_value = [(mock_sats [1 ], mock_sats [0 ])]
77+ )
78+ comms .last_communication_time = 0.0
79+ mock_sats [0 ].simulator .sim_time = 1.0
80+ comms .link_satellites (mock_sats )
81+ comms ._communicate_all = MagicMock ()
82+ comms .communicate ()
83+ comms ._communicate_all .assert_not_called ()
84+
6285
6386class TestNoCommunication :
6487 def test_communicate (self ):
0 commit comments