#44 Tests
Merged 3 years ago by humaton. Opened 3 years ago by humaton.
humaton/fedscm-admin tests  into  master

Tests
Tomas Hrcka • 3 years ago  
file modified
+1
@@ -10,4 +10,5 @@ 

  .coverage

  .vscode/

  .pytest_cache/

+ venv/

  *~

file modified
+1 -1
@@ -137,7 +137,7 @@ 

          branch_type, global_component, branch))

      existing_branch = get_branch(global_component, branch, branch_type)

      if existing_branch is not None:

-         if existing_branch['slas']:

+         if existing_branch.get('slas', False):

              raise ValidationError(

                  'The PDC branch already exists and has SLAs tied to it')

          else:

file modified
-1
@@ -246,7 +246,6 @@ 

                  issue_body['sls'] = get_standard_branch_sla_dict(branch)

              except ValidationError:  # pragma: no cover

                  pass

- 

      if 'branch' in issue_body and 'namespace' in issue_body:

          branch = issue_body['branch']

          ns = issue_body['namespace']

file modified
+3 -18
@@ -172,7 +172,7 @@ 

          mock_rv.json.return_value = {}

          mock_session.get.side_effect = [

              mock_values.get_mock_issue_rv(

-                 'abc', sla={'security_fixes': '2025-06-01'}, namespace='modules'),

+                 'master', namespace='modules'),

              mock_values.get_mock_users_query('akhairna'),

              mock_values.get_mock_pagure_project(exists=False),

              mock_values.get_mock_pdc_branch('abc', exists=False),
@@ -191,14 +191,7 @@ 

              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

+         assert result.output.count('- Closing Pagure issue 2') == 1

          assert self.mock_git_obj.clone_repo.call_count == 0

  

      @patch('fedscm_admin.utils.verify_slas', return_value=None)
@@ -215,7 +208,7 @@ 

          mock_rv.json.return_value = {}

          mock_session.get.side_effect = [

              mock_values.get_mock_issue_rv(

-                 'abc', sla={'security_fixes': '2025-06-01'}, namespace='tests'),

+                 'master', namespace='tests'),

              mock_values.get_mock_users_query('akhairna'),

              mock_values.get_mock_pagure_project(exists=False),

              mock_values.get_mock_pdc_branch('abc', exists=False),
@@ -234,14 +227,6 @@ 

              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

          assert self.mock_git_obj.clone_repo.call_count == 0

  

      @patch('fedscm_admin.utils.verify_slas', return_value=None)