def setUp(self): self.input = I3BarInput() self.input.need_event = True self._stdin = mock.patch("bumblebee.input.sys.stdin") self.stdin = self._stdin.start() self._select = mock.patch("bumblebee.input.select") self.select = self._select.start() self.popen = mocks.MockPopen() self.stdin.fileno.return_value = 1 poll = mock.Mock() self.select.poll.return_value = poll poll.poll.return_value = [(self.stdin.fileno.return_value, 2)] self.anyModule = mock.Mock() self.anyModule.id = mocks.rand(10) self.anotherModule = mock.Mock() self.anotherModule.id = mocks.rand(10) self.anyWidget = mocks.MockWidget("some-widget") self.anotherWidget = mocks.MockWidget("another-widget") self.anyData = self.invalidData = "any data" self.invalidEvent = json.dumps({ "name": None, "instance": None, "button": 1 }) self.incompleteEvent = json.dumps({"button": 1}) self.anyCommand = "this is a command with arguments" self._called = 0
def setUp(self): engine = mock.Mock() engine.input = mock.Mock() config = Config() self.objects = {} self.popen = mocks.MockPopen() self.popen.mock.communicate.return_value = (str.encode("1"), "error") self.popen.mock.returncode = 0 self._platform = mock.patch("bumblebee.modules.kernel.platform") self.platform = self._platform.start() self.platform.release.return_value = "unknown linux v1" for mod in all_modules(): name = "bumblebee.modules.{}".format(mod["name"]) cls = importlib.import_module(name) self.objects[mod["name"]] = getattr(cls, "Module")(engine, { "config": config }) for widget in self.objects[mod["name"]].widgets(): self.assertEquals(widget.get("variable", None), None)
def setUp(self): self.popen = mocks.MockPopen("bumblebee.util") self.some_command_with_args = "sample-command -a -b -c" self.some_utf8 = "some string".encode("utf-8")