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