From c76804ad921ed069b0638729547a1e4ddafc763e Mon Sep 17 00:00:00 2001 From: erik Date: Fri, 3 Mar 2023 14:55:38 +0100 Subject: [PATCH] Make counters count up --- .../ddadevops/release-mixin/test/mock_domain.py | 7 ++++--- .../release-mixin/test/mock_infrastructure.py | 6 ++++-- .../release-mixin/test/mock_infrastructure_api.py | 14 +++++++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/python/ddadevops/release-mixin/test/mock_domain.py b/src/main/python/ddadevops/release-mixin/test/mock_domain.py index 1031c3e..b5b4b65 100644 --- a/src/main/python/ddadevops/release-mixin/test/mock_domain.py +++ b/src/main/python/ddadevops/release-mixin/test/mock_domain.py @@ -32,15 +32,16 @@ class MockRelease(): self.release_type = release_type self.version = version self.current_branch = current_branch + self.validate_count = 0 def release_version(self): - return MockVersion() + return self.version.create_release_version(self.release_type) def bump_version(self): - return MockVersion() + return self.release_version().create_bump_version() def validate(self, main_branch): - self.validate_count =+ 1 + self.validate_count += 1 return self.is_valid def is_valid(self, main_branch): diff --git a/src/main/python/ddadevops/release-mixin/test/mock_infrastructure.py b/src/main/python/ddadevops/release-mixin/test/mock_infrastructure.py index 3908fec..6e66498 100644 --- a/src/main/python/ddadevops/release-mixin/test/mock_infrastructure.py +++ b/src/main/python/ddadevops/release-mixin/test/mock_infrastructure.py @@ -14,12 +14,13 @@ class MockVersionRepository(): def __init__(self): self.file = None self.file_handler = None + self.write_file_count = 0 def load_file(self): pass def write_file(self, version_string): - self.write_file_count =+ 1 + self.write_file_count += 1 pass def parse_file(self): @@ -40,7 +41,8 @@ class MockReleaseRepository(): self.version_repository = version_repository self.release_type_repository = release_type_repository self.main_branch = main_branch + self.get_release_count = 0 def get_release(self) -> MockRelease: - self.get_release_count =+ 1 + self.get_release_count += 1 return MockRelease(self.release_type_repository.get_release_type(), self.version_repository.get_version(), self.main_branch) \ No newline at end of file diff --git a/src/main/python/ddadevops/release-mixin/test/mock_infrastructure_api.py b/src/main/python/ddadevops/release-mixin/test/mock_infrastructure_api.py index 3791fa6..e073b7f 100644 --- a/src/main/python/ddadevops/release-mixin/test/mock_infrastructure_api.py +++ b/src/main/python/ddadevops/release-mixin/test/mock_infrastructure_api.py @@ -15,6 +15,10 @@ class MockGitApi(): def __init__(self): self.system_api = MockSystemAPI() + self.tag_annotated_count = 0 + self.add_file_count = 0 + self.commit_count = 0 + self.push_count = 0 def get_latest_n_commits(self, n: int): return " " @@ -22,8 +26,8 @@ class MockGitApi(): def get_latest_commit(self): return " " - def tag_annotated(self, annotation: str, message: str, count: int): - self.tag_annotated_count =+ 1 + def tag_annotated(self, annotation: str, message: str, count: int): + self.tag_annotated_count += 1 return " " def get_latest_tag(self): @@ -36,15 +40,15 @@ class MockGitApi(): pass def add_file(self, file_path): - self.add_file_count =+ 1 + self.add_file_count += 1 return " " def commit(self, commit_message: str): - self.commit_count =+ 1 + self.commit_count += 1 return commit_message def push(self): - self.push_count =+ 1 + self.push_count += 1 return " " def checkout(self, branch: str):