From 1cccaedbcebb4865236d2553684c0df405a61978 Mon Sep 17 00:00:00 2001
From: Lukas Holecek <hluk@email.cz>
Date: Oct 31 2018 16:18:50 +0000
Subject: Fix dependencies in spec file


Signed-off-by: Lukas Holecek <hluk@email.cz>

---

diff --git a/tests/test_cli.py b/tests/test_cli.py
index 43ffdf2..5610beb 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -159,9 +159,9 @@ def test_oidc_auth_is_enabled(tmpdir):
         mock_rv = Mock()
         mock_rv.json.return_value = [{
             "comment": "This is fine",
+            "data": {"item": ["htop-1.0-1.fc22"], "type": ["bodhi_update"]},
             "id": 15,
             "product_version": "Parrot",
-            "subject": {"subject.test": "test", "s": "t"},
             "testcase": "test.testcase",
             "timestamp": "2017-010-16T17:42:04.209638",
             "username": "foo",
@@ -179,16 +179,15 @@ oidc_scopes=
     openid
             """)
         runner = CliRunner()
-        args = ['-C', p.strpath, '-p', 'Parrot', '-s', '{"subject.test": "test", "s": "t"}',
-                '-t', 'test.testcase', '-c', "This is fine"]
+        args = ['-C', p.strpath, '-p', 'Parrot', '-r', '123',
+                '-c', "This is fine"]
         result = runner.invoke(waiverdb_cli, args)
-        exp_json = {
-            "subject": {"subject.test": "test", "s": "t"},
-            "testcase": "test.testcase",
-            'waived': True,
-            'product_version': 'Parrot',
-            'comment': "This is fine"
-        }
+        exp_json = [{
+            "result_id": 123,
+            "waived": True,
+            "product_version": "Parrot",
+            "comment": "This is fine",
+        }]
         mock_oidc_req.assert_called_once_with(
             url='http://localhost:5004/api/v1.0/waivers/',
             data=json.dumps(exp_json),
@@ -196,23 +195,17 @@ oidc_scopes=
             timeout=60,
             headers={'Content-Type': 'application/json'})
         assert result.exit_code == 0
-        assert result.output.startswith('Created waiver 15 for result with subject ')
-        assert result.output.endswith(' and testcase test.testcase\n')
-        assert any(['{"subject.test": "test", "s": "t"}' in result.output,
-                    '{"s": "t", "subject.test": "test"}' in result.output])
+        assert result.output.startswith('Created waiver 15 for result with id 123\n')
 
 
 def test_gssapi_is_enabled(tmpdir):
-    # Skip if waiverdb is rebuilt for an environment where OIDC authentication
-    # is used and python-requests-gssapi is not available.
-    pytest.importorskip('requests_gssapi')
     with patch('requests.request') as mock_request:
         mock_rv = Mock()
         mock_rv.json.return_value = [{
             "comment": "This is fine",
+            "data": {"item": ["htop-1.0-1.fc22"], "type": ["bodhi_update"]},
             "id": 15,
             "product_version": "Parrot",
-            "subject": {"subject.test": "test", "s": "t"},
             "testcase": "test.testcase",
             "timestamp": "2017-010-16T17:42:04.209638",
             "username": "foo",
@@ -226,14 +219,11 @@ auth_method=Kerberos
 api_url=http://localhost:5004/api/v1.0
             """)
         runner = CliRunner()
-        args = ['-C', p.strpath, '-p', 'Parrot', '-s', '{"subject.test": "test", "s": "t"}',
-                '-t', 'test.testcase', '-c', "This is fine"]
+        args = ['-C', p.strpath, '-p', 'Parrot', '-r', '123',
+                '-c', "This is fine"]
         result = runner.invoke(waiverdb_cli, args)
         mock_request.assert_called_once()
-        assert result.output.startswith('Created waiver 15 for result with subject ')
-        assert result.output.endswith(' and testcase test.testcase\n')
-        assert any(['{"subject.test": "test", "s": "t"}' in result.output,
-                    '{"s": "t", "subject.test": "test"}' in result.output])
+        assert result.output.startswith('Created waiver 15 for result with id 123\n')
 
 
 def test_submit_waiver_with_id(tmpdir):
diff --git a/waiverdb.spec b/waiverdb.spec
index 6eb2948..d2a44fc 100644
--- a/waiverdb.spec
+++ b/waiverdb.spec
@@ -36,6 +36,7 @@ BuildRequires:  python3-flask-restful
 BuildRequires:  python3-flask-sqlalchemy
 BuildRequires:  python3-psycopg2
 BuildRequires:  python3-gssapi
+BuildRequires:  python3-requests-gssapi
 BuildRequires:  python3-pytest
 BuildRequires:  python3-mock
 BuildRequires:  python3-flask-oidc
@@ -64,7 +65,7 @@ Requires:       python3-flask-restful
 Requires:       python3-flask-sqlalchemy
 Requires:       python3-psycopg2
 Requires:       python3-gssapi
-Requires:       python-requests-gssapi
+Requires:       python3-requests-gssapi
 Requires:       python3-mock
 Requires:       python3-flask-oidc
 Requires:       python3-click
@@ -89,10 +90,12 @@ for other WaiverDB subpackages.
 Summary: A CLI tool for interacting with waiverdb
 %if 0%{?fedora} || 0%{?rhel} > 7
 BuildRequires:  python3-click
+BuildRequires:  python3-requests-gssapi
 Requires:       python3-click
 Requires:       python3-requests-gssapi
 %else
 BuildRequires:  python-click
+BuildRequires:  python-requests-gssapi
 Requires:       python-click
 Requires:       python-requests-gssapi
 Requires:       python-configparser

