Un-tested though :(
@ignatenkobrain @tibbs @limb @mohanboddu if you could test it :)
if not auto_approve
Better
2 new commits added
Make flake8 happy and thus the test suite pass
Move setting the monitoring status to dist-git
Do we still need to do git clone for scm-requests repo with this? I think not.
git clone
I think not either indeed
Can you drop it please? Otherwise I just have tested it and it works.
Can you drop it please?
sure, let me figure out how to do that :)
Otherwise I just have tested it and it works.
awesome :fireworks: \ó/
1 new commit added
Drop cloning the fedora-scm-requests git repo
@ignatenkobrain Let's see if that does it :)
Ok, last small thing. The tests are failing:
______________________________________________________________________ FedScmAdmin.test_fedscm_admin_process _______________________________________________________________________ self = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process>, mock_retry_session = <MagicMock name='retry_session' id='139770912094096'> mock_slas = <MagicMock name='verify_slas' id='139770912466064'> @patch('fedscm_admin.utils.verify_slas', return_value=None) @patch('fedscm_admin.request_utils.retry_session') def test_fedscm_admin_process(self, mock_retry_session, mock_slas): """ Tests fedscm-admin with the option "process" on a new repo request for a repo with a non-standard branch """ from fedscm_admin.fedscm_admin import cli as fedscm_admin_cli mock_session = Mock() mock_rv = Mock() mock_rv.ok = True mock_rv.json.return_value = {} mock_session.get.side_effect = [ mock_values.get_mock_issue_rv( 'abc', sla={'security_fixes': '2025-06-01'}), mock_values.get_mock_users_query('akhairna'), mock_values.get_mock_pagure_project(exists=False), mock_values.get_mock_pdc_branch('abc', exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pdc_global_component(exists=True), mock_values.get_mock_pdc_branch('abc', exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pagure_git_urls() ] mock_session.post.return_value = mock_rv mock_session.patch.return_value = mock_rv mock_retry_session.return_value = mock_session runner = CliRunner() result = runner.invoke( fedscm_admin_cli, ['process', '2'], input='mprahl\n12345\nmprahl\n12345\napprove\nn\n') assert result.exit_code == 0 assert result.output.count('- Adding comment to Pagure issue') == 1 assert result.output.count('- Adding comment to rhbz#') == 1 outputs = [ 'New Repo for "rpms/nethack"', 'The Pagure repository was created', 'You may commit to the branch "abc" in about 10 minutes.' ] for output in outputs: assert output in result.output # One for fedora-scm-requests > assert self.mock_git_obj.clone_repo.call_count == 1 E AssertionError: assert 0 == 1 E + where 0 = <Mock name='GitRepo().clone_repo' id='139770912457392'>.call_count E + where <Mock name='GitRepo().clone_repo' id='139770912457392'> = <Mock name='GitRepo()' id='139770912094336'>.clone_repo E + where <Mock name='GitRepo()' id='139770912094336'> = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process>.mock_git_obj tests/test_admin.py:160: AssertionError ___________________________________________________________________ FedScmAdmin.test_fedscm_admin_process_epel7 ____________________________________________________________________ self = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_epel7>, mock_retry_session = <MagicMock name='retry_session' id='139770912040992'> mock_slas = <MagicMock name='verify_slas' id='139770911266176'> @patch('fedscm_admin.utils.verify_slas', return_value=None) @patch('fedscm_admin.request_utils.retry_session') def test_fedscm_admin_process_epel7( self, mock_retry_session, mock_slas): """ Tests fedscm-admin with the option "process" on a new repo request for a repo with an EPEL7 branch and no sla provided """ from fedscm_admin.fedscm_admin import cli as fedscm_admin_cli import fedscm_admin.bugzilla self.mock_bz_patcher.stop() self.mock_bz_patcher = patch.object( fedscm_admin.bugzilla.BugzillaClient, 'client', mock_values.MockBugzilla('Fedora EPEL')) self.mock_bz = self.mock_bz_patcher.start() mock_session = Mock() mock_rv = Mock() mock_rv.ok = True mock_rv.json.return_value = {} mock_session.get.side_effect = [ mock_values.get_mock_issue_rv('epel7'), mock_values.get_mock_el_check_rv(), mock_values.get_mock_users_query('akhairna'), mock_values.get_mock_pagure_project(exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pdc_branch('epel7', exists=False), mock_values.get_mock_pdc_global_component(exists=True), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pdc_branch('epel7', exists=False), mock_values.get_mock_pagure_git_urls() ] mock_session.post.return_value = mock_rv mock_session.patch.return_value = mock_rv mock_retry_session.return_value = mock_session runner = CliRunner() result = runner.invoke( fedscm_admin_cli, ['process', '2'], input='mprahl\n12345\nmprahl\n12345\napprove\nn\n') assert result.exit_code == 0 assert 'New Repo for "rpms/nethack"' in result.output assert 'The Pagure repository was created' in result.output assert 'You may commit to the branch "epel7" in about 10 minutes.' in \ result.output # One for fedora-scm-requests > assert self.mock_git_obj.clone_repo.call_count == 1 E AssertionError: assert 0 == 1 E + where 0 = <Mock name='GitRepo().clone_repo' id='139770911281792'>.call_count E + where <Mock name='GitRepo().clone_repo' id='139770911281792'> = <Mock name='GitRepo()' id='139770912040800'>.clone_repo E + where <Mock name='GitRepo()' id='139770912040800'> = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_epel7>.mock_git_obj tests/test_admin.py:339: AssertionError _________________________________________________________________ FedScmAdmin.test_fedscm_admin_process_exception __________________________________________________________________ self = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_exception>, mock_retry_session = <MagicMock name='retry_session' id='139770911929632'> mock_slas = <MagicMock name='verify_slas' id='139770911195488'> @patch('fedscm_admin.utils.verify_slas', return_value=None) @patch('fedscm_admin.request_utils.retry_session') def test_fedscm_admin_process_exception( self, mock_retry_session, mock_slas): """ Tests fedscm-admin on a ticket for a repo with a non-standard branch and with the exception flag set to True """ from fedscm_admin.fedscm_admin import cli as fedscm_admin_cli mock_session = Mock() mock_rv = Mock() mock_rv.ok = True mock_rv.json.return_value = {} mock_session.get.side_effect = [ mock_values.get_mock_issue_rv( 'abc', sla={'security_fixes': '2025-12-01'}, exception=True), mock_values.get_mock_users_query('akhairna'), mock_values.get_mock_pagure_project(exists=False), mock_values.get_mock_pdc_branch('abc', exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pdc_global_component(exists=True), mock_values.get_mock_pdc_branch('abc', exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pagure_git_urls() ] mock_session.post.return_value = mock_rv mock_session.patch.return_value = mock_rv mock_retry_session.return_value = mock_session runner = CliRunner() result = runner.invoke( fedscm_admin_cli, ['process', '2'], input='mprahl\n12345\nmprahl\n12345\napprove\nn\n') assert result.exit_code == 0 assert '- Skipping verification of RHBZ' in result.output error = ('WARNING: The requester states this request is an ' 'exception and doesn\'t require Bugzilla validation. Please ' 'manually verify it.') assert error in result.output assert result.output.count('- Adding comment to Pagure issue') == 1 outputs = [ 'New Repo for "rpms/nethack"', 'The Pagure repository was created', 'You may commit to the branch "abc" in about 10 minutes.' ] for output in outputs: assert output in result.output # One for fedora-scm-requests > assert self.mock_git_obj.clone_repo.call_count == 1 E AssertionError: assert 0 == 1 E + where 0 = <Mock name='GitRepo().clone_repo' id='139770911210080'>.call_count E + where <Mock name='GitRepo().clone_repo' id='139770911210080'> = <Mock name='GitRepo()' id='139770911930208'>.clone_repo E + where <Mock name='GitRepo()' id='139770911930208'> = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_exception>.mock_git_obj tests/test_admin.py:257: AssertionError ___________________________________________________________________ FedScmAdmin.test_fedscm_admin_process_force ____________________________________________________________________ self = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_force>, mock_retry_session = <MagicMock name='retry_session' id='139770911925008'> mock_slas = <MagicMock name='verify_slas' id='139770911920288'> @patch('fedscm_admin.utils.verify_slas', return_value=None) @patch('fedscm_admin.request_utils.retry_session') def test_fedscm_admin_process_force( self, mock_retry_session, mock_slas): """ Tests fedscm-admin with the option "process" on a new repo request for a repo with a non-standard branch """ from fedscm_admin.fedscm_admin import cli as fedscm_admin_cli mock_session = Mock() mock_rv = Mock() mock_rv.ok = True mock_rv.json.return_value = {} mock_session.get.side_effect = [ mock_values.get_mock_issue_rv( 'abc', sla={'security_fixes': '2025-12-01'}), mock_values.get_mock_users_query('akhairna'), mock_values.get_mock_pagure_project(exists=False), mock_values.get_mock_pdc_branch('abc', exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pdc_global_component(exists=True), mock_values.get_mock_pdc_branch('abc', exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pagure_git_urls() ] mock_session.post.return_value = mock_rv mock_session.patch.return_value = mock_rv mock_retry_session.return_value = mock_session runner = CliRunner() result = runner.invoke( fedscm_admin_cli, ['process', '2', '--force'], input='mprahl\n12345\nmprahl\n12345\napprove\nn\n') assert result.exit_code == 0 assert '- Skipping verification of RHBZ' in result.output assert 'WARNING: The Bugzilla bug validation was skipped' \ in result.output assert result.output.count('- Adding comment to Pagure issue') == 1 assert result.output.count('- Adding comment to rhbz#') == 1 outputs = [ 'New Repo for "rpms/nethack"', 'The Pagure repository was created', 'You may commit to the branch "abc" in about 10 minutes.' ] for output in outputs: assert output in result.output # One for fedora-scm-requests > assert self.mock_git_obj.clone_repo.call_count == 1 E AssertionError: assert 0 == 1 E + where 0 = <Mock name='GitRepo().clone_repo' id='139770911189696'>.call_count E + where <Mock name='GitRepo().clone_repo' id='139770911189696'> = <Mock name='GitRepo()' id='139770911924816'>.clone_repo E + where <Mock name='GitRepo()' id='139770911924816'> = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_force>.mock_git_obj tests/test_admin.py:208: AssertionError ___________________________________________________________ FedScmAdmin.test_fedscm_admin_process_master_epel_bz_prduct ____________________________________________________________ self = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_master_epel_bz_prduct>, mock_retry_session = <MagicMock name='retry_session' id='139770912459168'> mock_slas = <MagicMock name='verify_slas' id='139770912139344'> @patch('fedscm_admin.utils.verify_slas', return_value=None) @patch('fedscm_admin.request_utils.retry_session') def test_fedscm_admin_process_master_epel_bz_prduct( self, mock_retry_session, mock_slas): """ Tests fedscm-admin with the option "process" on a new repo request for a repo with the master branch and the Bugzilla bug's product is "Fedora EPEL" """ from fedscm_admin.fedscm_admin import cli as fedscm_admin_cli import fedscm_admin.bugzilla self.mock_bz_patcher.stop() self.mock_bz_patcher = patch.object( fedscm_admin.bugzilla.BugzillaClient, 'client', mock_values.MockBugzilla('Fedora EPEL')) self.mock_bz = self.mock_bz_patcher.start() mock_session = Mock() mock_rv = Mock() mock_rv.ok = True mock_rv.json.return_value = {} mock_session.get.side_effect = [ mock_values.get_mock_issue_rv('master'), mock_values.get_mock_users_query('akhairna'), mock_values.get_mock_pagure_project(exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pdc_global_component(exists=True), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pagure_git_urls() ] mock_session.post.return_value = mock_rv mock_session.patch.return_value = mock_rv mock_retry_session.return_value = mock_session runner = CliRunner() result = runner.invoke( fedscm_admin_cli, ['process', '2'], input='mprahl\n12345\nmprahl\n12345\napprove\nn\n') assert result.exit_code == 0 assert 'New Repo for "rpms/nethack"' in result.output assert 'The Pagure repository was created' in result.output # One for fedora-scm-requests > assert self.mock_git_obj.clone_repo.call_count == 1 E AssertionError: assert 0 == 1 E + where 0 = <Mock name='GitRepo().clone_repo' id='139770912183056'>.call_count E + where <Mock name='GitRepo().clone_repo' id='139770912183056'> = <Mock name='GitRepo()' id='139770912476416'>.clone_repo E + where <Mock name='GitRepo()' id='139770912476416'> = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_master_epel_bz_prduct>.mock_git_obj tests/test_admin.py:381: AssertionError ___________________________________________________________ FedScmAdmin.test_fedscm_admin_process_standard_branch_no_sla ___________________________________________________________ self = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_standard_branch_no_sla>, mock_retry_session = <MagicMock name='retry_session' id='139770911312864'> mock_slas = <MagicMock name='verify_slas' id='139770911369536'> @patch('fedscm_admin.utils.verify_slas', return_value=None) @patch('fedscm_admin.request_utils.retry_session') def test_fedscm_admin_process_standard_branch_no_sla( self, mock_retry_session, mock_slas): """ Tests fedscm-admin with the option "process" on a new repo request for a repo with a standard branch and no sla provided """ from fedscm_admin.fedscm_admin import cli as fedscm_admin_cli mock_session = Mock() mock_rv = Mock() mock_rv.ok = True mock_rv.json.return_value = {} mock_session.get.side_effect = [ mock_values.get_mock_issue_rv('master'), mock_values.get_mock_users_query('akhairna'), mock_values.get_mock_pagure_project(exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pdc_global_component(exists=True), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pagure_git_urls() ] mock_session.post.return_value = mock_rv mock_session.patch.return_value = mock_rv mock_retry_session.return_value = mock_session runner = CliRunner() result = runner.invoke( fedscm_admin_cli, ['process', '2'], input='mprahl\n12345\nmprahl\n12345\napprove\nn\n') assert result.exit_code == 0 assert 'New Repo for "rpms/nethack"' in result.output assert 'The Pagure repository was created' in result.output assert 'You may create the branch' not in result.output # One for fedora-scm-requests > assert self.mock_git_obj.clone_repo.call_count == 1 E AssertionError: assert 0 == 1 E + where 0 = <Mock name='GitRepo().clone_repo' id='139770911290176'>.call_count E + where <Mock name='GitRepo().clone_repo' id='139770911290176'> = <Mock name='GitRepo()' id='139770911312672'>.clone_repo E + where <Mock name='GitRepo()' id='139770911312672'> = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_process_standard_branch_no_sla>.mock_git_obj tests/test_admin.py:293: AssertionError _____________________________________________________________________ FedScmAdmin.test_fedscm_admin_processall _____________________________________________________________________ self = <tests.test_admin.FedScmAdmin testMethod=test_fedscm_admin_processall>, mock_retry_session = <MagicMock name='retry_session' id='139770912358112'> mock_slas = <MagicMock name='verify_slas' id='139770911209840'> @patch('fedscm_admin.utils.verify_slas', return_value=None) @patch('fedscm_admin.request_utils.retry_session') def test_fedscm_admin_processall(self, mock_retry_session, mock_slas): """ Tests fedscm-admin with the option "processall" on a new repo request and a new branch request """ from fedscm_admin.fedscm_admin import cli as fedscm_admin_cli from fedscm_admin import STANDARD_BRANCH_SLAS mock_session = Mock() mock_rv = Mock() mock_rv.ok = True mock_rv.json.return_value = {} issue_title, issue_content = mock_values.get_mock_new_repo_issue( 'master', STANDARD_BRANCH_SLAS['master']) issue = mock_values.build_issue(1, issue_title, issue_content) branch_issue_title, branch_issue_content = \ mock_values.get_mock_new_branch_issue( 'abc', {'security_fixes': '2025-12-01'}) branch_issue = mock_values.build_issue( 2, branch_issue_title, branch_issue_content) mock_session.get.side_effect = [ mock_values.get_mock_issues_rv([branch_issue, issue]), mock_values.get_mock_users_query('akhairna'), mock_values.get_mock_pagure_project(exists=False), mock_values.get_mock_pdc_branch('master', exists=False), mock_values.get_mock_pdc_global_component(exists=True), mock_values.get_mock_pdc_branch(None, exists=False), mock_values.get_mock_pagure_git_urls(), mock_values.get_mock_pagure_project(exists=True), mock_values.get_mock_pagure_git_urls(is_project=True), mock_values.get_mock_pdc_branch(None, exists=False), mock_values.get_mock_pdc_global_component(exists=True), mock_values.get_mock_pdc_branch('abc', exists=False), mock_values.get_mock_pagure_git_urls(is_project=True), ] mock_session.post.return_value = mock_rv mock_session.patch.return_value = mock_rv mock_retry_session.return_value = mock_session runner = CliRunner() result = runner.invoke( fedscm_admin_cli, ['processall'], input='mprahl\n12345\nmprahl\n12345\napprove\nn\napprove\nn\n') > assert result.exit_code == 0 E AssertionError: assert 1 == 0 E + where 1 = <Result KeyError('urls')>.exit_code tests/test_admin.py:729: AssertionError
Doh! of course they are, should I see this coming
3 new commits added
Now with passing unit-tests :)
LGTM :thumbsup:
I can test it
Pull-Request has been merged by ignatenkobrain