Implement release class test

This commit is contained in:
erik 2023-03-02 16:07:13 +01:00
parent 8eb510d034
commit 63d3823d87

View file

@ -17,12 +17,10 @@ sys.path.append(parent)
# now we can import the module in the parent # now we can import the module in the parent
# directory. # directory.
from domain import Version, ReleaseType from domain import Version, ReleaseType, Release
from infrastructure import VersionRepository
def test_version(tmp_path): def test_version(tmp_path: Path):
version = Version(tmp_path, [1, 2, 3]) version = Version(tmp_path, [1, 2, 3])
version.increment(ReleaseType.SNAPSHOT) version.increment(ReleaseType.SNAPSHOT)
assert version.get_version_string() == "1.2.3-SNAPSHOT" assert version.get_version_string() == "1.2.3-SNAPSHOT"
assert version.version_list == [1, 2, 3] assert version.version_list == [1, 2, 3]
@ -51,3 +49,13 @@ def test_version(tmp_path):
assert version.get_version_string() == "2.0.0" assert version.get_version_string() == "2.0.0"
assert version.version_list == [2, 0, 0] assert version.version_list == [2, 0, 0]
assert not version.is_snapshot assert not version.is_snapshot
def test_release(tmp_path):
version = Version(tmp_path, [1, 2, 3])
release = Release(ReleaseType.MINOR, version, "main")
release_version = release.release_version()
assert release_version.get_version_string() in '1.3.0'
bump_version = release.bump_version()
assert bump_version.get_version_string() in "1.3.1-SNAPSHOT"