Commit 31cb6c3f authored by Michal Vaner's avatar Michal Vaner
Browse files

Test that check_command would wait forever

If there's no command and we want to use a block mode, it should wait
forever for the command.

git-svn-id: svn:// e5f2f494-b856-4b98-b285-d166d9295462
parent eaefef0e
......@@ -23,7 +23,7 @@ import unittest
import os
from isc.config.ccsession import *
from isc.config.config_data import BIND10_CONFIG_DATA_VERSION
from unittest_fakesession import FakeModuleCCSession
from unittest_fakesession import FakeModuleCCSession, WouldBlockForever
class TestHelperFunctions(unittest.TestCase):
def test_parse_answer(self):
......@@ -361,8 +361,8 @@ class TestModuleCCSession(unittest.TestCase):
self.assertEqual(len(fake_session.message_queue), 0)
"""See if the message gets there even in blocking mode."""
def test_check_command_block(self):
"""See if the message gets there even in blocking mode."""
fake_session = self.common_check_command_check(
lambda mccs, _: mccs.check_command(False))
......@@ -370,8 +370,8 @@ class TestModuleCCSession(unittest.TestCase):
self.assertEqual({'result': [0]},
fake_session.get_message('Spec2', None))
"""Check it works if session has timeout and it sets it back."""
def test_check_command_block_timeout(self):
"""Check it works if session has timeout and it sets it back."""
def cmd_check(mccs, session):
......@@ -382,6 +382,13 @@ class TestModuleCCSession(unittest.TestCase):
fake_session.get_message('Spec2', None))
self.assertEqual(fake_session.get_timeout(), 1)
def test_check_command_blocks_forever(self):
"""Check it would wait forever checking a command."""
fake_session = FakeModuleCCSession()
mccs = self.create_session("spec2.spec", None, None, fake_session)
self.assertRaises(WouldBlockForever, lambda: mccs.check_command(False))
def test_remote_module(self):
fake_session = FakeModuleCCSession()
mccs = self.create_session("spec1.spec", None, None, fake_session)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment