#322 Return update karma to argparse after validation
Merged 2 years ago by onosek. Opened 2 years ago by cqi.
cqi/fedpkg fix-update  into  master

file modified
+14 -3
@@ -152,7 +152,8 @@ 

      # Do not operate OpenIDC session file with lock


      def assert_bodhi_update(self, cli, _load_cookies, send_request, csrf,

-                             update_type=None, request_type=None, notes=None):

+                             update_type=None, request_type=None, notes=None,

+                             stable_karma=None, unstable_karma=None):

          csrf.return_value = '123456'


          def run_command_side_effect(command, shell):
@@ -186,8 +187,8 @@ 

              'suggest': 'unspecified',

              'type': update_type,

              'type_': update_type,

-             'stable_karma': '3',

-             'unstable_karma': '-3',

+             'stable_karma': stable_karma or '3',

+             'unstable_karma': unstable_karma or '-3',

              'csrf_token': csrf.return_value,


          if notes:
@@ -255,6 +256,16 @@ 


              ['vi', 'bodhi.template'], shell=True)


+     def test_request_update_with_karma(self):

+         cli_cmd = [

+             'fedpkg', '--path', self.cloned_repo_path, 'update',

+             '--stable-karma', '1', '--unstable-karma', '-1'

+         ]


+         cli = self.get_cli(cli_cmd)

+         self.assert_bodhi_update(cli, update_type='enhancement',

+                                  stable_karma='1', unstable_karma='-1')


      @patch('fedpkg.Commands.update', side_effect=OSError)

      def test_handle_any_errors_raised_when_execute_bodhi(self, update):

          cli_cmd = ['fedpkg', '--path', self.cloned_repo_path, 'update']

Fixes #321

Signed-off-by: Chenxiong Qi cqi@redhat.com

rebased onto bae228f

2 years ago

Is your fix complete? I can see just file from test/ dir.

I just inspected the source code and found out the fix was included in f44c3ea already. I think the reason is probably because my local branch is out-dated accidentally. After I fixed the issue, rebased it on master branch, then only test_cli.py is inlcuded in patch eventually. But, I didn't notice that. Sorry for that.

Do you want me to keep this patch to add the test? If yes, I'll update the commit message accordingly.

No problem. Why not, let's keep the additional test. Thanks

Commit c2b8c4f fixes this pull-request

Pull-Request has been merged by onosek

2 years ago