diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index b89344e5..e130f522 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -51,7 +51,7 @@ cassette_dir = base_dir + '/vcr-request-data/' user = ('Homer J. Simpson', set(['packager'])) -class MockedSCM(object): +class FakeSCM(object): def __init__(self, mocked_scm, name, mmd_filename, commit=None): self.mocked_scm = mocked_scm self.name = name @@ -269,7 +269,7 @@ class TestBuild(unittest.TestCase): Tests the build of testmodule.yaml using FakeModuleBuilder which succeeds everytime. """ - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -320,7 +320,7 @@ class TestBuild(unittest.TestCase): @patch('module_build_service.scm.SCM') def test_submit_build_from_yaml_not_allowed( self, mocked_scm, mocked_get_user, conf_system, dbg): - MockedSCM(mocked_scm, "testmodule", "testmodule.yaml") + FakeSCM(mocked_scm, "testmodule", "testmodule.yaml") testmodule = os.path.join(base_dir, 'staged_data', 'testmodule.yaml') with open(testmodule) as f: @@ -339,7 +339,7 @@ class TestBuild(unittest.TestCase): @patch('module_build_service.auth.get_user', return_value=user) @patch('module_build_service.scm.SCM') def test_submit_build_from_yaml_allowed(self, mocked_scm, mocked_get_user, conf_system, dbg): - MockedSCM(mocked_scm, "testmodule", "testmodule.yaml") + FakeSCM(mocked_scm, "testmodule", "testmodule.yaml") testmodule = os.path.join(base_dir, 'staged_data', 'testmodule.yaml') with open(testmodule) as f: @@ -382,7 +382,7 @@ class TestBuild(unittest.TestCase): """ Submit all builds for a module and cancel the module build later. """ - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -435,7 +435,7 @@ class TestBuild(unittest.TestCase): Tests the build of testmodule.yaml using FakeModuleBuilder which succeeds everytime. """ - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -470,7 +470,7 @@ class TestBuild(unittest.TestCase): Tests the build of testmodule.yaml using FakeModuleBuilder with num_concurrent_builds set to 1. """ - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -515,7 +515,7 @@ class TestBuild(unittest.TestCase): the previous one finished without waiting for all the num_concurrent_builds to finish. """ - MockedSCM(mocked_scm, 'testmodule-more-components', 'testmodule-more-components.yaml', + FakeSCM(mocked_scm, 'testmodule-more-components', 'testmodule-more-components.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -568,7 +568,7 @@ class TestBuild(unittest.TestCase): Tests that if the build in batch fails, other components in a batch are still build, but next batch is not started. """ - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -628,7 +628,7 @@ class TestBuild(unittest.TestCase): Tests that if the build in batch fails, other components in a batch are still build, but next batch is not started. """ - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -778,7 +778,7 @@ class TestBuild(unittest.TestCase): Tests that resuming the build works even when previous batches are already built. """ - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -856,7 +856,7 @@ class TestLocalBuild(unittest.TestCase): """ with app.app_context(): module_build_service.utils.load_local_builds(["base-runtime"]) - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post( diff --git a/tests/test_scheduler/test_module_init.py b/tests/test_scheduler/test_module_init.py index d796caf5..441e3b95 100644 --- a/tests/test_scheduler/test_module_init.py +++ b/tests/test_scheduler/test_module_init.py @@ -26,7 +26,7 @@ from mock import patch, PropertyMock import vcr from tests import conf, db -from tests.test_views.test_views import MockedSCM +from tests.test_views.test_views import FakeSCM import module_build_service.messaging import module_build_service.scheduler.handlers.modules from module_build_service import build_logs @@ -68,7 +68,7 @@ class TestModuleInit(unittest.TestCase): @patch('module_build_service.scm.SCM') def test_init_basic(self, mocked_scm): - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') msg = module_build_service.messaging.MBSModule( msg_id=None, module_build_id=1, module_build_state='init') @@ -85,7 +85,7 @@ class TestModuleInit(unittest.TestCase): def mocked_scm_get_latest(): raise RuntimeError("Failed in mocked_scm_get_latest") - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') mocked_scm.return_value.get_latest = mocked_scm_get_latest msg = module_build_service.messaging.MBSModule( @@ -101,7 +101,7 @@ class TestModuleInit(unittest.TestCase): new_callable=PropertyMock, return_value=True) @patch('module_build_service.scm.SCM') def test_init_includedmodule(self, mocked_scm, mocked_mod_allow_repo): - MockedSCM(mocked_scm, "includedmodules", ['testmodule.yaml']) + FakeSCM(mocked_scm, "includedmodules", ['testmodule.yaml']) includedmodules_yml_path = os.path.join( self.staged_data_dir, 'includedmodules.yaml') with open(includedmodules_yml_path, 'r') as f: @@ -137,7 +137,7 @@ class TestModuleInit(unittest.TestCase): @patch('module_build_service.models.ModuleBuild.from_module_event') @patch('module_build_service.scm.SCM') def test_init_when_get_latest_raises(self, mocked_scm, mocked_from_module_event): - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '7035bd33614972ac66559ac1fdd019ff6027ad22', get_latest_raise=True) msg = module_build_service.messaging.MBSModule( diff --git a/tests/test_utils/test_utils.py b/tests/test_utils/test_utils.py index 0cfd38e5..a7067c9f 100644 --- a/tests/test_utils/test_utils.py +++ b/tests/test_utils/test_utils.py @@ -41,7 +41,7 @@ CASSETTES_DIR = path.join( path.abspath(path.dirname(__file__)), '..', 'vcr-request-data') -class MockedSCM(object): +class FakeSCM(object): def __init__(self, mocked_scm, name, mmd_filename, commit=None): self.mocked_scm = mocked_scm self.name = name @@ -578,7 +578,7 @@ class TestUtils(unittest.TestCase): Tests that the module resubmit reintializes the module state and component states properly. """ - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') with app.app_context(): test_reuse_component_init_data() diff --git a/tests/test_views/test_views.py b/tests/test_views/test_views.py index 0a9c34fa..e378689a 100644 --- a/tests/test_views/test_views.py +++ b/tests/test_views/test_views.py @@ -49,7 +49,7 @@ base_dir = dirname(dirname(__file__)) cassette_dir = base_dir + '/vcr-request-data/' -class MockedSCM(object): +class FakeSCM(object): def __init__(self, mocked_scm, name, mmd_filenames, commit=None, checkout_raise=False, get_latest_raise=False): """ @@ -431,7 +431,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.get_user', return_value=user) @patch('module_build_service.scm.SCM') def test_submit_build(self, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -462,7 +462,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.get_user', return_value=user) @patch('module_build_service.scm.SCM') def test_submit_componentless_build(self, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, 'fakemodule', 'fakemodule.yaml', + FakeSCM(mocked_scm, 'fakemodule', 'fakemodule.yaml', '3da541559918a808c2402bba5012f6c60b27661c') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -524,7 +524,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.get_user', return_value=user) @patch('module_build_service.scm.SCM') def test_submit_build_bad_modulemd(self, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, "bad", "bad.yaml") + FakeSCM(mocked_scm, "bad", "bad.yaml") rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' @@ -538,7 +538,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.scm.SCM') def test_submit_build_includedmodule_custom_repo_not_allowed(self, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, "includedmodules", ["includedmodules.yaml", + FakeSCM(mocked_scm, "includedmodules", ["includedmodules.yaml", "testmodule.yaml"]) rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( {'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/' @@ -640,7 +640,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.get_user', return_value=user) @patch('module_build_service.scm.SCM') def test_submit_build_version_set_error(self, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, 'testmodule', 'testmodule-version-set.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule-version-set.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -658,7 +658,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.get_user', return_value=user) @patch('module_build_service.scm.SCM') def test_submit_build_wrong_stream(self, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, 'testmodule', 'testmodule-wrong-stream.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule-wrong-stream.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -689,7 +689,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.scm.SCM') @patch("module_build_service.config.Config.no_auth", new_callable=PropertyMock, return_value=True) def test_submit_build_no_auth_set_owner(self, mocked_conf, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') data = { @@ -708,7 +708,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.scm.SCM') @patch("module_build_service.config.Config.no_auth", new_callable=PropertyMock) def test_patch_set_different_owner(self, mocked_no_auth, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') mocked_no_auth.return_value = True @@ -736,7 +736,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.auth.get_user', return_value=user) @patch('module_build_service.scm.SCM') def test_submit_build_commit_hash_not_found(self, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '7035bd33614972ac66559ac1fdd019ff6027ad22', checkout_raise=True) rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps( @@ -754,7 +754,7 @@ class TestViews(unittest.TestCase): @patch('module_build_service.scm.SCM') @patch("module_build_service.config.Config.allow_custom_scmurls", new_callable=PropertyMock) def test_submit_custom_scmurl(self, allow_custom_scmurls, mocked_scm, mocked_get_user): - MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml', + FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml', '620ec77321b2ea7b0d67d82992dda3e1d67055b4') def submit(scmurl):