1
0

test_version_manager.py 1.3 KB

123456789101112131415161718192021222324252627282930
  1. # Copyright 2021-2025 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. from taipy.common.config import Config
  12. from taipy.core._version._version import _Version
  13. from taipy.core._version._version_manager import _VersionManager
  14. def test_save_and_get_version_entity(tmpdir):
  15. _VersionManager._repository.base_path = tmpdir
  16. assert len(_VersionManager._get_all()) == 0
  17. version = _Version(id="foo", config=Config._applied_config)
  18. _VersionManager._get_or_create(id="foo", force=False)
  19. version_1 = _VersionManager._get(version.id)
  20. assert version_1.id == version.id
  21. assert Config._serializer._str(version_1.config) == Config._serializer._str(version.config)
  22. assert len(_VersionManager._get_all()) == 1
  23. assert _VersionManager._get(version.id) == version