Ejemplo n.º 1
0
    def test_hk_cert_rotation_without_exception(self, mock_CertRotation,
                                                cert_rotate_event_mock):
        # mock cert_rotate object
        cert_rotate_mock = mock.MagicMock()
        # mock rotate()
        rotate_mock = mock.MagicMock()

        cert_rotate_mock.rotate = rotate_mock

        mock_CertRotation.return_value = cert_rotate_mock

        # mock cert_rotate_thread_event.is_set() in the while loop
        cert_rotate_event_mock.is_set = mock.MagicMock()
        cert_rotate_event_mock.is_set.side_effect = [False, True]

        self.assertIsNone(house_keeping.cert_rotation())

        mock_CertRotation.assert_called_once_with()
        self.assertEqual(1, cert_rotate_mock.rotate.call_count)
Ejemplo n.º 2
0
    def test_hk_cert_rotation_without_exception(self, mock_CertRotation,
                                                cert_rotate_event_mock):
        # mock cert_rotate object
        cert_rotate_mock = mock.MagicMock()
        # mock rotate()
        rotate_mock = mock.MagicMock()

        cert_rotate_mock.rotate = rotate_mock

        mock_CertRotation.return_value = cert_rotate_mock

        # mock cert_rotate_thread_event.is_set() in the while loop
        cert_rotate_event_mock.is_set = mock.MagicMock()
        cert_rotate_event_mock.is_set.side_effect = [False, True]

        self.assertIsNone(house_keeping.cert_rotation())

        mock_CertRotation.assert_called_once_with()
        self.assertEqual(1, cert_rotate_mock.rotate.call_count)