WIP fixing tests
This commit is contained in:
parent
97c5c4eb91
commit
8fd243a60d
2 changed files with 8 additions and 9 deletions
|
@ -32,12 +32,11 @@ class MockReleaseTypeRepository():
|
||||||
return ReleaseType.MINOR
|
return ReleaseType.MINOR
|
||||||
|
|
||||||
class MockReleaseRepository():
|
class MockReleaseRepository():
|
||||||
def __init__(self, version_repository: MockVersionRepository, release_type_repository: MockReleaseTypeRepository, main_branch: str):
|
def __init__(self, version_repository: MockVersionRepository, release_type_repository: MockReleaseTypeRepository):
|
||||||
self.version_repository = version_repository
|
self.version_repository = version_repository
|
||||||
self.release_type_repository = release_type_repository
|
self.release_type_repository = release_type_repository
|
||||||
self.main_branch = main_branch
|
|
||||||
self.get_release_count = 0
|
self.get_release_count = 0
|
||||||
|
|
||||||
def get_release(self) -> ReleaseContext:
|
def get_release(self, main_branch) -> ReleaseContext:
|
||||||
self.get_release_count += 1
|
self.get_release_count += 1
|
||||||
return ReleaseContext(self.release_type_repository.get_release_type(), self.version_repository.get_version(), self.main_branch)
|
return ReleaseContext(self.release_type_repository.get_release_type(), self.version_repository.get_version(), main_branch)
|
||||||
|
|
|
@ -4,17 +4,17 @@ from src.test.python.release_mixin import MockGitApi
|
||||||
|
|
||||||
def test_prepare_release_service():
|
def test_prepare_release_service():
|
||||||
# init
|
# init
|
||||||
mock_release_repo = MockReleaseRepository(MockVersionRepository(), MockReleaseTypeRepository(MockGitApi()), 'main')
|
mock_release_repo = MockReleaseRepository(MockVersionRepository(), MockReleaseTypeRepository(MockGitApi()))
|
||||||
prepare_release_service = PrepareReleaseService()
|
prepare_release_service = PrepareReleaseService()
|
||||||
prepare_release_service.git_api = MockGitApi()
|
prepare_release_service.git_api = MockGitApi()
|
||||||
prepare_release_service.write_and_commit_release(mock_release_repo.get_release(), mock_release_repo.version_repository)
|
prepare_release_service.write_and_commit_release(mock_release_repo.get_release("main"), mock_release_repo.version_repository)
|
||||||
|
|
||||||
#test
|
#test
|
||||||
assert prepare_release_service.git_api.add_file_count == 1
|
assert prepare_release_service.git_api.add_file_count == 1
|
||||||
assert prepare_release_service.git_api.commit_count == 1
|
assert prepare_release_service.git_api.commit_count == 1
|
||||||
|
|
||||||
# init
|
# init
|
||||||
prepare_release_service.write_and_commit_bump(mock_release_repo.get_release(), mock_release_repo.version_repository)
|
prepare_release_service.write_and_commit_bump(mock_release_repo.get_release("main"), mock_release_repo.version_repository)
|
||||||
|
|
||||||
# test
|
# test
|
||||||
assert prepare_release_service.git_api.add_file_count == 2
|
assert prepare_release_service.git_api.add_file_count == 2
|
||||||
|
@ -22,8 +22,8 @@ def test_prepare_release_service():
|
||||||
|
|
||||||
def test_tag_and_push_release_service():
|
def test_tag_and_push_release_service():
|
||||||
# init
|
# init
|
||||||
mock_release_repo = MockReleaseRepository(MockVersionRepository(), MockReleaseTypeRepository(MockGitApi()), 'main')
|
mock_release_repo = MockReleaseRepository(MockVersionRepository(), MockReleaseTypeRepository(MockGitApi()))
|
||||||
tag_and_push_release_service = TagAndPushReleaseService(MockGitApi())
|
tag_and_push_release_service = TagAndPushReleaseService(MockGitApi(), "main")
|
||||||
tag_and_push_release_service.tag_release(mock_release_repo)
|
tag_and_push_release_service.tag_release(mock_release_repo)
|
||||||
tag_and_push_release_service.push_release()
|
tag_and_push_release_service.push_release()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue