mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Implement set/getProperty for MockContainer
Otherwise setProperty/getProperty tests will never work
This commit is contained in:
parent
7175ac0d20
commit
dc84141714
1 changed files with 17 additions and 1 deletions
|
@ -19,16 +19,32 @@ class MockContainer:
|
||||||
self._id = container_id
|
self._id = container_id
|
||||||
self._type = type
|
self._type = type
|
||||||
|
|
||||||
|
self._property_map = {}
|
||||||
|
|
||||||
def getId(self):
|
def getId(self):
|
||||||
return self._id
|
return self._id
|
||||||
|
|
||||||
def getMetaDataEntry(self, entry, default = None):
|
def getMetaDataEntry(self, entry, default = None):
|
||||||
print(entry, self._type)
|
|
||||||
if entry == "type":
|
if entry == "type":
|
||||||
return self._type
|
return self._type
|
||||||
|
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
def getProperty(self, key, property_name):
|
||||||
|
if key not in self._property_map:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if property_name not in self._property_map[key]:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return self._property_map[key][property_name]
|
||||||
|
|
||||||
|
def setProperty(self, key, property_name, value):
|
||||||
|
if key not in self._property_map:
|
||||||
|
self._property_map[key] = {}
|
||||||
|
|
||||||
|
self._property_map[key][property_name] = value
|
||||||
|
|
||||||
propertyChanged = unittest.mock.MagicMock()
|
propertyChanged = unittest.mock.MagicMock()
|
||||||
|
|
||||||
## Fake container registry that always provides all containers you ask of.
|
## Fake container registry that always provides all containers you ask of.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue