73 lines
1.6 KiB
Python
73 lines
1.6 KiB
Python
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 = ""):
|
|
self.system_api = MockSystemApi()
|
|
self.get_latest_commit_count = 0
|
|
self.commit_string = commit_string
|
|
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 " "
|
|
|
|
def get_latest_commit(self):
|
|
self.get_latest_commit_count += 1
|
|
return self.commit_string
|
|
|
|
def tag_annotated(self, annotation: str, message: str, count: int):
|
|
self.tag_annotated_count += 1
|
|
return " "
|
|
|
|
def tag_annotated_second_last(self, annotation: str, message: str):
|
|
self.tag_annotated(annotation, message, 1)
|
|
return " "
|
|
|
|
def get_latest_tag(self):
|
|
return " "
|
|
|
|
def get_current_branch(self):
|
|
return " "
|
|
|
|
def init(self):
|
|
pass
|
|
|
|
def add_file(self, file_path):
|
|
self.add_file_count += 1
|
|
return " "
|
|
|
|
def commit(self, commit_message: str):
|
|
self.commit_count += 1
|
|
return commit_message
|
|
|
|
def push(self):
|
|
self.push_count += 1
|
|
return " "
|
|
|
|
def checkout(self, branch: str):
|
|
return " "
|
|
|
|
class MockEnvironmentApi():
|
|
|
|
def __init__(self, environ_map):
|
|
self.environ = environ_map
|
|
|
|
def get(self, name):
|
|
return self.environ.get(name)
|
|
|
|
def set(self, name, value):
|
|
self.environ[name] = value
|