1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-19 04:21:17 +00:00
2017-02-21 15:02:28 +00:00

40 lines
1.0 KiB
Python

from mock import Mock
from nose.tools import assert_true
from wa.framework import signal
from wa.framework.plugin import Plugin
from wa.utils.types import identifier
class SignalWatcher(object):
signals = []
def __init__(self):
for sig in self.signals:
name = identifier(sig.name)
callback = Mock()
callback.im_func.__name__ = name
setattr(self, name, callback)
signal.connect(getattr(self, name), sig)
def assert_all_called(self):
for m in self.__dict__.itervalues():
assert_true(m.called)
class MockContainerActor(Plugin):
name = 'mock-container'
kind = 'container-actor'
def __init__(self, owner=None, *args, **kwargs):
super(MockContainerActor, self).__init__(*args, **kwargs)
self.owner=owner
self.initialize = Mock()
self.finalize = Mock()
self.enter = Mock()
self.exit = Mock()
self.job_started = Mock()
self.job_completed = Mock()