Skip to content

Commit

Permalink
Add test for get_current_version
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanTolksdorf committed Sep 27, 2023
1 parent 1c484bd commit 1493f5f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/version/commands/test_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,34 @@ def test_update_version(self):
version_file_path.unlink()
readme_file_path.unlink()

def test_no_update_version(self):
version_file_path = Path("upgradeVersion.json")
version_file_path.write_text(
TEMPLATE_UPGRADE_VERSION_JSON, encoding="utf-8"
)

version = "2023.9.3"
readme_file_path = Path("README.md")
readme_file_path.write_text(
TEMPLATE_UPGRADE_VERSION_MARKDOWN.format(version), encoding="utf-8"
)

updated_version_obj = JavaVersionCommand(
SemanticVersioningScheme
).update_version(SemanticVersioningScheme.parse_version(version))

self.assertEqual(updated_version_obj.previous, SemanticVersioningScheme.parse_version(version))
self.assertEqual(updated_version_obj.new, SemanticVersioningScheme.parse_version(new_version))
self.assertEqual(
updated_version_obj.changed_files, []
)

content = readme_file_path.read_text(encoding="UTF-8")
self.assertEqual(content, TEMPLATE_UPGRADE_VERSION_MARKDOWN.format(version))

version_file_path.unlink()
readme_file_path.unlink()

def test_forced_update_version(self):
with temp_directory(change_into=True):
version_file_path = Path("upgradeVersion.json")
Expand Down

0 comments on commit 1493f5f

Please sign in to comment.