mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-24 02:32:26 +08:00
Simplify format_mmd since scm.commit is always set or returns an exception
This commit is contained in:
@@ -102,6 +102,8 @@ class FakeSCM(object):
|
||||
self.mocked_scm.return_value.branch = branch
|
||||
self.mocked_scm.return_value.sourcedir = self.sourcedir
|
||||
self.mocked_scm.return_value.get_module_yaml = self.get_module_yaml
|
||||
self.mocked_scm.return_value.is_full_commit_hash.return_value = commit and len(commit) == 40
|
||||
self.mocked_scm.return_value.get_full_commit_hash.return_value = self.get_full_commit_hash
|
||||
|
||||
def checkout(self, temp_dir):
|
||||
try:
|
||||
@@ -124,6 +126,12 @@ class FakeSCM(object):
|
||||
def get_module_yaml(self):
|
||||
return path.join(self.sourcedir, self.name + ".yaml")
|
||||
|
||||
def get_full_commit_hash(self, commit_hash=None):
|
||||
if not commit_hash:
|
||||
commit_hash = self.commit
|
||||
sha1_hash = hashlib.sha1("random").hexdigest()
|
||||
return commit_hash + sha1_hash[len(commit_hash):]
|
||||
|
||||
|
||||
class TestViews:
|
||||
def setup_method(self, test_method):
|
||||
|
||||
Reference in New Issue
Block a user