Update tests for git handler
This commit is contained in:
parent
0b3daf595a
commit
ac564ade7e
1 changed files with 40 additions and 6 deletions
|
@ -17,14 +17,48 @@ 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 git_handler import *
|
from git_repository import *
|
||||||
|
from release_type import ReleaseType
|
||||||
|
|
||||||
def test_git_handler():
|
def test_git_repository():
|
||||||
|
|
||||||
# init
|
# init
|
||||||
repo = GitRepo()
|
commit_string = "Major bla"
|
||||||
repo.get_commits()
|
repo = GitRepository.create_from_commit_string(commit_string)
|
||||||
|
release_type = repo.get_release_type_from_latest_commit()
|
||||||
|
|
||||||
#test
|
#test
|
||||||
assert type(repo.commits) == dict
|
assert release_type == ReleaseType.MAJOR
|
||||||
assert repo.commits["decd36b"] == ["(tag:refs/tags/TEST)", "Initial commit"]
|
|
||||||
|
|
||||||
|
# init
|
||||||
|
commit_string = "MINOR bla"
|
||||||
|
repo = GitRepository.create_from_commit_string(commit_string)
|
||||||
|
release_type = repo.get_release_type_from_latest_commit()
|
||||||
|
|
||||||
|
#test
|
||||||
|
assert release_type == ReleaseType.MINOR
|
||||||
|
|
||||||
|
# init
|
||||||
|
commit_string = "PATCH bla"
|
||||||
|
repo = GitRepository.create_from_commit_string(commit_string)
|
||||||
|
release_type = repo.get_release_type_from_latest_commit()
|
||||||
|
|
||||||
|
# test
|
||||||
|
assert release_type == ReleaseType.PATCH
|
||||||
|
|
||||||
|
# init
|
||||||
|
commit_string = "SNAPSHOT bla"
|
||||||
|
repo = GitRepository.create_from_commit_string(commit_string)
|
||||||
|
release_type = repo.get_release_type_from_latest_commit()
|
||||||
|
|
||||||
|
#test
|
||||||
|
assert release_type == ReleaseType.SNAPSHOT
|
||||||
|
|
||||||
|
# init
|
||||||
|
commit_string = "bla"
|
||||||
|
repo = GitRepository.create_from_commit_string(commit_string)
|
||||||
|
release_type = repo.get_release_type_from_latest_commit()
|
||||||
|
|
||||||
|
#test
|
||||||
|
assert release_type == None
|
||||||
|
|
Loading…
Reference in a new issue