From 4c1d31d23d95b032e2f8859ab4580720c2518720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com> Date: Thu, 6 Jun 2013 18:06:06 +0200 Subject: [PATCH] Add slapobject mockups --- slapos/tests/slapobject.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/slapos/tests/slapobject.py b/slapos/tests/slapobject.py index 2d282f9c5..196dcd176 100644 --- a/slapos/tests/slapobject.py +++ b/slapos/tests/slapobject.py @@ -37,6 +37,25 @@ from slapos.grid import networkcache # XXX: BasicMixin should be in a separated module, not in slapgrid test module. from slapos.tests.slapgrid import BasicMixin +# Mockup +# XXX: Ambiguous name +# XXX: Factor with common SlapOS tests +class FakeCallAndStore(object): + """ + Used to check if the mocked method has been called. + """ + def __init__(self): + self.called = False + + def __call__(self, *args, **kwargs): + self.called = True + +class FakeCallAndNoop(object): + """ + Used to no-op a method. + """ + def __call__(self, *args, **kwargs): + pass # XXX: change name and behavior to be more generic and factor with other tests class FakeNetworkCacheCallAndRead(object): -- 2.30.9