Exemplo n.º 1
0
 def test_determine_time_method_chronyd(self, mock_execute):
     mock_execute.side_effect = [
         ('', ''),  # Returns nothing on ntpdate call
     ]
     calls = [mock.call('chronyd', '-h')]
     return_value = utils.determine_time_method()
     self.assertEqual('chronyd', return_value)
     mock_execute.assert_has_calls(calls)
Exemplo n.º 2
0
 def test_determine_time_method_ntpdate(self, mock_execute):
     mock_execute.side_effect = [
         OSError,  # No chronyd found
         ('', ''),  # Returns nothing on ntpdate call
     ]
     calls = [mock.call('chronyd', '-h'),
              mock.call('ntpdate', '-v', check_exit_code=[0, 1])]
     return_value = utils.determine_time_method()
     self.assertEqual('ntpdate', return_value)
     mock_execute.assert_has_calls(calls)
Exemplo n.º 3
0
 def test_determine_time_method_none(self, mock_execute):
     mock_execute.side_effect = OSError
     self.assertIsNone(utils.determine_time_method())