mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-05 11:48:33 +08:00
Fix typo in test_reuse_component_init_data name, set SERVER_NAME config variable in config.py, return commit in MockedSCM.get_latest
This commit is contained in:
@@ -155,6 +155,7 @@ class TestConfiguration(BaseConfiguration):
|
||||
|
||||
KOJI_CONFIG = './conf/koji.conf'
|
||||
KOJI_PROFILE = 'staging'
|
||||
SERVER_NAME = 'localhost'
|
||||
|
||||
|
||||
class ProdConfiguration(BaseConfiguration):
|
||||
|
||||
@@ -33,7 +33,6 @@ from module_build_service.utils import get_scm_url_re
|
||||
import module_build_service.pdc
|
||||
|
||||
app = module_build_service.app
|
||||
app.config['SERVER_NAME'] = 'localhost'
|
||||
conf = init_config(app)
|
||||
|
||||
def init_data():
|
||||
@@ -243,7 +242,7 @@ def scheduler_init_data():
|
||||
session.commit()
|
||||
|
||||
|
||||
def test_resuse_component_init_data():
|
||||
def test_reuse_component_init_data():
|
||||
db.session.remove()
|
||||
db.drop_all()
|
||||
db.create_all()
|
||||
|
||||
@@ -28,7 +28,7 @@ import module_build_service.utils
|
||||
import module_build_service.scm
|
||||
from module_build_service import models, conf
|
||||
from module_build_service.errors import ProgrammingError, ValidationError
|
||||
from tests import test_resuse_component_init_data, init_data, db
|
||||
from tests import test_reuse_component_init_data, init_data, db
|
||||
import mock
|
||||
from mock import PropertyMock
|
||||
import koji
|
||||
@@ -64,7 +64,7 @@ class MockedSCM(object):
|
||||
return scm_dir
|
||||
|
||||
def get_latest(self, branch = 'master'):
|
||||
return branch
|
||||
return self.commit if self.commit else branch
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
|
||||
@@ -116,14 +116,14 @@ class TestUtils(unittest.TestCase):
|
||||
self.assertEqual(mmd.xmd, xmd)
|
||||
|
||||
def test_get_reusable_component_same(self):
|
||||
test_resuse_component_init_data()
|
||||
test_reuse_component_init_data()
|
||||
new_module = models.ModuleBuild.query.filter_by(id=2).one()
|
||||
rv = module_build_service.utils.get_reusable_component(
|
||||
db.session, new_module, 'tangerine')
|
||||
self.assertEqual(rv.package, 'tangerine')
|
||||
|
||||
def test_get_reusable_component_different_perl_tangerine(self):
|
||||
test_resuse_component_init_data()
|
||||
test_reuse_component_init_data()
|
||||
second_module_build = models.ModuleBuild.query.filter_by(id=2).one()
|
||||
mmd = second_module_build.mmd()
|
||||
mmd.components.rpms['perl-Tangerine'].ref = \
|
||||
@@ -153,7 +153,7 @@ class TestUtils(unittest.TestCase):
|
||||
self.assertEqual(tangerine_rv, None)
|
||||
|
||||
def test_get_reusable_component_different_buildrequires_hash(self):
|
||||
test_resuse_component_init_data()
|
||||
test_reuse_component_init_data()
|
||||
second_module_build = models.ModuleBuild.query.filter_by(id=2).one()
|
||||
mmd = second_module_build.mmd()
|
||||
mmd.xmd['mbs']['buildrequires']['base-runtime']['ref'] = \
|
||||
@@ -177,7 +177,7 @@ class TestUtils(unittest.TestCase):
|
||||
self.assertEqual(tangerine_rv, None)
|
||||
|
||||
def test_get_reusable_component_different_buildrequires(self):
|
||||
test_resuse_component_init_data()
|
||||
test_reuse_component_init_data()
|
||||
second_module_build = models.ModuleBuild.query.filter_by(id=2).one()
|
||||
mmd = second_module_build.mmd()
|
||||
mmd.buildrequires = {'some_module': 'master'}
|
||||
@@ -326,7 +326,7 @@ class TestUtils(unittest.TestCase):
|
||||
MockedSCM(mocked_scm, 'testmodule', 'testmodule-bootstrap.yaml',
|
||||
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
|
||||
with app.app_context():
|
||||
test_resuse_component_init_data()
|
||||
test_reuse_component_init_data()
|
||||
# Mark the module build as failed, so we can resubmit it.
|
||||
module_build = models.ModuleBuild.query.filter_by(id=2).one()
|
||||
module_build.batch = 2
|
||||
@@ -418,7 +418,7 @@ class DummyModuleBuilder(GenericBuilder):
|
||||
class TestBatches(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
test_resuse_component_init_data()
|
||||
test_reuse_component_init_data()
|
||||
GenericBuilder.register_backend_class(DummyModuleBuilder)
|
||||
|
||||
def tearDown(self):
|
||||
|
||||
Reference in New Issue
Block a user