Add slapobject mockups

parent 854ac7d7
...@@ -37,6 +37,25 @@ from slapos.grid import networkcache ...@@ -37,6 +37,25 @@ from slapos.grid import networkcache
# XXX: BasicMixin should be in a separated module, not in slapgrid test module. # XXX: BasicMixin should be in a separated module, not in slapgrid test module.
from slapos.tests.slapgrid import BasicMixin 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 # XXX: change name and behavior to be more generic and factor with other tests
class FakeNetworkCacheCallAndRead(object): class FakeNetworkCacheCallAndRead(object):
......
Markdown is supported
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