2023-03-03 13:31:51 +01:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
current = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
parent = os.path.dirname(current)
|
|
|
|
sys.path.append(parent)
|
|
|
|
|
|
|
|
from domain import ReleaseType
|
|
|
|
|
|
|
|
class MockVersion():
|
|
|
|
|
|
|
|
def __init__(self, id = None, version_list = None):
|
|
|
|
self.id = None
|
|
|
|
self.version_list = None
|
|
|
|
self.version_string = None
|
|
|
|
self.is_snapshot = None
|
|
|
|
|
|
|
|
def increment(self, release_type: ReleaseType):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def get_version_string(self) -> str:
|
|
|
|
return ""
|
|
|
|
|
|
|
|
def create_release_version(self, release_type: ReleaseType):
|
|
|
|
return MockVersion()
|
|
|
|
|
|
|
|
def create_bump_version(self):
|
|
|
|
return MockVersion()
|
|
|
|
|
|
|
|
class MockRelease():
|
|
|
|
def __init__(self, release_type, version, current_branch):
|
|
|
|
self.release_type = release_type
|
|
|
|
self.version = version
|
|
|
|
self.current_branch = current_branch
|
2023-03-03 14:55:38 +01:00
|
|
|
self.validate_count = 0
|
2023-03-03 13:31:51 +01:00
|
|
|
|
|
|
|
def release_version(self):
|
2023-03-03 14:55:38 +01:00
|
|
|
return self.version.create_release_version(self.release_type)
|
2023-03-03 13:31:51 +01:00
|
|
|
|
|
|
|
def bump_version(self):
|
2023-03-03 14:55:38 +01:00
|
|
|
return self.release_version().create_bump_version()
|
2023-03-03 13:31:51 +01:00
|
|
|
|
|
|
|
def validate(self, main_branch):
|
2023-03-03 14:55:38 +01:00
|
|
|
self.validate_count += 1
|
2023-03-03 13:31:51 +01:00
|
|
|
return self.is_valid
|
|
|
|
|
|
|
|
def is_valid(self, main_branch):
|
|
|
|
return True
|