mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-12-01 00:37:08 +08:00
Fix #619: Support for module YAML file validation within a SCM repository
This commit is contained in:
@@ -47,6 +47,7 @@ class MockedSCM(object):
|
||||
self.name = name
|
||||
self.commit = commit
|
||||
self.mmd_filename = mmd_filename
|
||||
self.sourcedir = None
|
||||
|
||||
self.mocked_scm.return_value.checkout = self.checkout
|
||||
self.mocked_scm.return_value.name = self.name
|
||||
@@ -54,19 +55,24 @@ class MockedSCM(object):
|
||||
self.mocked_scm.return_value.get_latest = self.get_latest
|
||||
self.mocked_scm.return_value.commit = self.commit
|
||||
self.mocked_scm.return_value.repository_root = "git://pkgs.stg.fedoraproject.org/modules/"
|
||||
self.mocked_scm.return_value.sourcedir = self.sourcedir
|
||||
self.mocked_scm.return_value.get_module_yaml = self.get_module_yaml
|
||||
|
||||
def checkout(self, temp_dir):
|
||||
scm_dir = path.join(temp_dir, self.name)
|
||||
mkdir(scm_dir)
|
||||
self.sourcedir = path.join(temp_dir, self.name)
|
||||
mkdir(self.sourcedir)
|
||||
base_dir = path.abspath(path.dirname(__file__))
|
||||
copyfile(path.join(base_dir, '..', 'staged_data', self.mmd_filename),
|
||||
path.join(scm_dir, self.name + ".yaml"))
|
||||
self.get_module_yaml())
|
||||
|
||||
return scm_dir
|
||||
return self.sourcedir
|
||||
|
||||
def get_latest(self, branch='master'):
|
||||
return self.commit if self.commit else branch
|
||||
|
||||
def get_module_yaml(self):
|
||||
return path.join(self.sourcedir, self.name + ".yaml")
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user