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
|
||||
# directory.
|
||||
|
||||
from git_handler import *
|
||||
from git_repository import *
|
||||
from release_type import ReleaseType
|
||||
|
||||
def test_git_handler():
|
||||
def test_git_repository():
|
||||
|
||||
# init
|
||||
repo = GitRepo()
|
||||
repo.get_commits()
|
||||
commit_string = "Major bla"
|
||||
repo = GitRepository.create_from_commit_string(commit_string)
|
||||
release_type = repo.get_release_type_from_latest_commit()
|
||||
|
||||
#test
|
||||
assert release_type == ReleaseType.MAJOR
|
||||
|
||||
|
||||
# init
|
||||
commit_string = "MINOR bla"
|
||||
repo = GitRepository.create_from_commit_string(commit_string)
|
||||
release_type = repo.get_release_type_from_latest_commit()
|
||||
|
||||
#test
|
||||
assert type(repo.commits) == dict
|
||||
assert repo.commits["decd36b"] == ["(tag:refs/tags/TEST)", "Initial commit"]
|
||||
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