#395 WiP: Added --scenario argument to CLI
Closed 3 years ago by vmaljulin. Opened 3 years ago by vmaljulin.
vmaljulin/waiverdb RHELWF-1882  into  master

file modified
+34
@@ -389,6 +389,40 @@ 

          )

  

  

+ def test_create_waiver_product_version_from_koji_build_scenario(tmpdir):

+     with patch('requests.request') as mock_request:

+         mock_rv = Mock()

+         mock_rv.json.return_value = [{

+             "comment": "This is fine",

+             "id": 15,

+             "subject_type": "koji_build",

+             "subject_identifier": "setup-2.8.71-7.el7_4",

+             "scenario": "somescenario",

+             "testcase": "test.testcase",

+             "timestamp": "2017-010-16T17:42:04.209638",

+             "username": "foo",

+             "waived": True

+         }]

+         mock_request.return_value = mock_rv

+         p = tmpdir.join('client.conf')

+         p.write("""

+ [waiverdb]

+ auth_method=dummy

+ api_url=http://localhost:5004/api/v1.0

+ koji_base_url=https://koji.fedoraproject.org/kojihub

+         """)

+         runner = CliRunner()

+         args = ['-C', p.strpath, '-s', '{"type": "koji_build", "item": "setup-2.8.71-7.el7_4"}',

+                 '-S', 'somescenario', '-t', 'test.testcase', '-c', "This is fine"]

+         result = runner.invoke(waiverdb_cli, args, catch_exceptions=False)

+         mock_request.assert_called()

+         assert result.output == (

+             'Created waiver 15 for result with '

+             'subject type koji_build, identifier setup-2.8.71-7.el7_4 '

+             'and testcase test.testcase, scenario is somescenario\n'

+         )

+ 

+ 

  def test_create_waiver_product_version_from_compose(tmpdir):

      with patch('requests.request') as mock_request:

          mock_rv = Mock()

file modified
+8 -2
@@ -86,6 +86,8 @@ 

              waiver_id = data['id']

              msg = 'subject type {0}, identifier {1} and testcase {2}'.format(

                  data['subject_type'], data['subject_identifier'], data['testcase'])

+             if data.get('scenario'):

+                 msg += f", scenario is {data['scenario']}"

              print_result(waiver_id, msg)

  

  
@@ -122,6 +124,8 @@ 

                help='Specify a config file to use')

  @click.option('--result-id', '-r', multiple=True, type=int,

                help='Specify one or more results to be waived')

+ @click.option('--scenario', '-S',

+               help='Specify a scenario for a result to waive')

  @click.option('--subject', '-s', type=OldJSONSubject(),

                help=('Deprecated. Use --subject-identifier and --subject-type instead. '

                      'Subject for a result to waive.'))
@@ -139,7 +143,7 @@ 

                help='A comment explaining why the result is waived')

  @click.option('--username', '-u', default=None,

                help='Username on whose behalf the caller is proxying.')

- def cli(username, comment, waived, product_version, testcase, subject, subject_identifier,

+ def cli(username, comment, waived, product_version, testcase, scenario, subject, subject_identifier,

          subject_type, result_id, config_file):

      """

      Creates new waiver against test results.
@@ -151,7 +155,7 @@ 

  

      \b

          waiverdb-cli -t dist.rpmdeplint -i qclib-1.3.1-3.fc28 -T koji_build \\

-             -p "fedora-28" -c "This is expected for non-x86 packages"

+             -p "fedora-28" -S "somescenario" -c "This is expected for non-x86 packages"

      """

      config = configparser.ConfigParser()

  
@@ -227,6 +231,8 @@ 

              'comment': comment,

              'username': username

          })

+         if scenario:

+             data_list[-1]['scenario'] = scenario

  

      # XXX - TODO - remove this in a future release.  (for backwards compat)

      for result_id in result_ids:

no initial comment

Build cec61f7dd293e351ded0b46ab32e3cb821603bef FAILED!
Rebase or make new commits to rebuild.

rebased onto 421266e9dc4aaf9287c99eab3c813a3b6bb7cfd4

3 years ago

Build 421266e9dc4aaf9287c99eab3c813a3b6bb7cfd4 FAILED!
Rebase or make new commits to rebuild.

rebased onto 88589cbe6d11df3640d60be11ea5f9b05d025484

3 years ago

Build 88589cbe6d11df3640d60be11ea5f9b05d025484 FAILED!
Rebase or make new commits to rebuild.

rebased onto bb5d6913820c73a52204555360c52e6b164b45fe

3 years ago

Build 46a39a7c420e9315cdcfde797e0717bfbba036fc FAILED!
Rebase or make new commits to rebuild.

2 new commits added

  • fixup! Added --scenario argument to CLI
  • Added --scenario argument to CLI
3 years ago

Build 4fa05ec8b4b9d99e39a40cbcc57fad036046b55c FAILED!
Rebase or make new commits to rebuild.

2 new commits added

  • fixup! Added --scenario argument to CLI
  • Added --scenario argument to CLI
3 years ago

Build c0c0f944bb3ef7d3b11d171085abcf4f5dedba77 FAILED!
Rebase or make new commits to rebuild.

2 new commits added

  • fixup! Added --scenario argument to CLI
  • Added --scenario argument to CLI
3 years ago

Build c12ae893d69995e651feab5f139ff97f4ba92769 FAILED!
Rebase or make new commits to rebuild.

rebased onto 2421f5d

3 years ago

Pull-Request has been closed by vmaljulin

3 years ago