dda-devops-build/src/test/python/release_mixin/mock_infrastructure_api.py

59 lines
1.3 KiB
Python
Raw Normal View History

2023-03-03 12:31:51 +00:00
class MockSystemAPI():
def __init__(self):
self.stdout = [""]
self.stderr = [""]
def run(self, args):
pass
def run_checked(self, *args):
self.run(args)
pass
class MockGitApi():
def __init__(self, commit_string = ""):
2023-03-03 12:31:51 +00:00
self.system_api = MockSystemAPI()
self.get_latest_commit_count = 0
self.commit_string = commit_string
self.tag_annotated_count = 0
2023-03-03 13:55:38 +00:00
self.add_file_count = 0
self.commit_count = 0
self.push_count = 0
2023-03-03 12:31:51 +00:00
2023-03-03 14:07:02 +00:00
def get_latest_n_commits(self, n: int):
2023-03-03 12:31:51 +00:00
return " "
def get_latest_commit(self):
self.get_latest_commit_count += 1
return self.commit_string
2023-03-03 12:31:51 +00:00
2023-03-03 14:07:02 +00:00
def tag_annotated(self, annotation: str, message: str, count: int):
2023-03-03 13:55:38 +00:00
self.tag_annotated_count += 1
2023-03-03 12:31:51 +00:00
return " "
2023-03-03 14:07:02 +00:00
def get_latest_tag(self):
2023-03-03 12:31:51 +00:00
return " "
def get_current_branch(self):
return " "
def init(self):
pass
def add_file(self, file_path):
2023-03-03 13:55:38 +00:00
self.add_file_count += 1
2023-03-03 12:31:51 +00:00
return " "
def commit(self, commit_message: str):
2023-03-03 13:55:38 +00:00
self.commit_count += 1
2023-03-03 12:31:51 +00:00
return commit_message
def push(self):
2023-03-03 13:55:38 +00:00
self.push_count += 1
2023-03-03 12:31:51 +00:00
return " "
def checkout(self, branch: str):
return " "