diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2019-03-20 11:51:06 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2019-03-20 11:51:06 +0300 |
commit | e555f7da68b5e81a9e135dfc48ac7cc04c6421f6 (patch) | |
tree | a92ef5940a68b97598bfc2c3dc57bd857234cd71 /tests/PrinterOutput | |
parent | 69eb381f1052de11f0da0e9167f5419c14f0dd0f (diff) |
Move ConfigurationModel into cura.UI module
Diffstat (limited to 'tests/PrinterOutput')
-rw-r--r-- | tests/PrinterOutput/TestConfigurationModel.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/tests/PrinterOutput/TestConfigurationModel.py b/tests/PrinterOutput/TestConfigurationModel.py deleted file mode 100644 index b16b8cb1f3..0000000000 --- a/tests/PrinterOutput/TestConfigurationModel.py +++ /dev/null @@ -1,45 +0,0 @@ - - -from unittest.mock import MagicMock - -import pytest - -from cura.PrinterOutput.ConfigurationModel import ConfigurationModel -from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel - -test_validate_data_get_set = [ - {"attribute": "extruderConfigurations", "value": [ExtruderConfigurationModel()]}, - {"attribute": "buildplateConfiguration", "value": "BHDHAHHADAD"}, - {"attribute": "printerType", "value": ":(", "check_signal": False}, -] - - -@pytest.mark.parametrize("data", test_validate_data_get_set) -def test_getAndSet(data): - model = ConfigurationModel() - - # Convert the first letter into a capital - attribute = list(data["attribute"]) - attribute[0] = attribute[0].capitalize() - attribute = "".join(attribute) - - # mock the correct emit - model.configurationChanged = MagicMock() - signal = model.configurationChanged - - # Attempt to set the value - getattr(model, "set" + attribute)(data["value"]) - - # Check if signal fired. - if data.get("check_signal", True): - assert signal.emit.call_count == 1 - - # Ensure that the value got set - assert getattr(model, data["attribute"]) == data["value"] - - # Attempt to set the value again - getattr(model, "set" + attribute)(data["value"]) - - # The signal should not fire again - if data.get("check_signal", True): - assert signal.emit.call_count == 1 |