TestVersionUpgrade43To44.py 968 B

123456789101112131415161718192021222324252627282930313233343536
  1. import configparser
  2. import VersionUpgrade43to44
  3. before_update = """[general]
  4. version = 4
  5. name = Ultimaker 3
  6. id = Ultimaker 3
  7. [metadata]
  8. type = machine
  9. [containers]
  10. 0 = user_profile
  11. 1 = quality_changes
  12. 2 = quality
  13. 3 = material
  14. 4 = variant
  15. 5 = definition_changes
  16. 6 = definition
  17. """
  18. def test_upgrade():
  19. upgrader = VersionUpgrade43to44.VersionUpgrade43to44()
  20. file_name, new_data = upgrader.upgradeStack(before_update, "whatever")
  21. parser = configparser.ConfigParser(interpolation=None)
  22. parser.read_string(new_data[0])
  23. assert parser["containers"]["0"] == "user_profile"
  24. assert parser["containers"]["1"] == "quality_changes"
  25. assert parser["containers"]["2"] == "empty_intent"
  26. assert parser["containers"]["3"] == "quality"
  27. assert parser["containers"]["4"] == "material"
  28. assert parser["containers"]["5"] == "variant"
  29. assert parser["containers"]["6"] == "definition_changes"
  30. assert parser["containers"]["7"] == "definition"