Skip to content
Snippets Groups Projects

Test to confirm (or reject) #71

Merged Alexander Schlemmer requested to merge f-confirm-setting-values into dev
1 file
+ 0
39
Compare changes
  • Side-by-side
  • Inline
@@ -664,42 +664,3 @@ def test_setting_values():
assert model["Simulation"].name == "Simulation"
assert model["Simulation"].get_property("parameter").value == 26
def test_sync_output(capfd):
model = parse_model_from_string("""
RT:
obligatory_properties:
identifier:
datatype: TEXT
""")
existing_entities = [db.RecordType(name="RT", id=25).add_property(name="identifier",
datatype="INTEGER",
importance="OBLIGATORY",
id=24),
db.Property(name="identifier", datatype="INTEGER", id=24)]
def get_existing_entities(ent_cont):
return existing_entities
class MockQuery:
def __init__(self, q):
self.q = q
def execute(self, unique=True):
id = int(self.q.split("=")[1])
for existing_ent in existing_entities:
if existing_ent.id == id:
return existing_ent
return None
model.get_existing_entities = get_existing_entities
caosadvancedtools.models.parser.db.Query = MockQuery
caosadvancedtools.models.parser.db.Container.update = Mock()
model.sync_data_model(True, True)
assert caosadvancedtools.models.parser.db.Container.update.called
output, err = capfd.readouterr()
print(output)
assert "version from the yaml file: TEXT" in output
assert "version from LinkAhead: INTEGER" in output
Loading