Exemplo n.º 1
0
class ValidationModelTest(unittest.TestCase):
    def setUp(self):
        events.unsub_all()
        self.workunit_provider = Mock(spec=PreFetchingWorkUnitProvider)
        self.image_manager = Mock(spec=ImageManager)
        self.synchronization_manager = Mock(spec=SynchronizationManager)
        self.model = ValidationModel(self.workunit_provider,
                                     self.image_manager,
                                     self.synchronization_manager)

    def test_all_workunits_unlocked_on_exit(self):
        workunit1 = MagicMock(spec=RealsWorkUnit)
        workunit2 = MagicMock(spec=RealsWorkUnit)

        self.model.add_workunit(workunit1)
        self.model.add_workunit(workunit2)

        self.model.exit()

        workunit1.unlock.assert_called_once_with()
        workunit2.unlock.assert_called_once_with()

    def test_workunit_provider_shutdown_on_exit(self):
        self.model.exit()
        self.workunit_provider.shutdown.assert_called_once_with()
Exemplo n.º 2
0
class ValidationModelTest(unittest.TestCase):
    def setUp(self):
        events.unsub_all()
        self.workunit_provider = Mock(spec=PreFetchingWorkUnitProvider)
        self.image_manager = Mock(spec=ImageManager)
        self.synchronization_manager = Mock(spec=SynchronizationManager)
        self.model = ValidationModel(self.workunit_provider, self.image_manager,
                                     self.synchronization_manager)

    def test_all_workunits_unlocked_on_exit(self):
        workunit1 = MagicMock(spec=RealsWorkUnit)
        workunit2 = MagicMock(spec=RealsWorkUnit)

        self.model.add_workunit(workunit1)
        self.model.add_workunit(workunit2)

        self.model.exit()

        workunit1.unlock.assert_called_once_with()
        workunit2.unlock.assert_called_once_with()

    def test_workunit_provider_shutdown_on_exit(self):
        self.model.exit()
        self.workunit_provider.shutdown.assert_called_once_with()