| |
@@ -3,7 +3,9 @@
|
| |
import json
|
| |
import pytest
|
| |
import re
|
| |
+ import os
|
| |
|
| |
+ from hashlib import sha256
|
| |
from textwrap import dedent
|
| |
|
| |
from greenwave import __version__
|
| |
@@ -38,7 +40,7 @@
|
| |
assert r.status_code == 200
|
| |
body = r.json()
|
| |
policies = body['policies']
|
| |
- assert len(policies) == 15
|
| |
+ assert len(policies) == 16
|
| |
assert any(p['id'] == 'taskotron_release_critical_tasks' for p in policies)
|
| |
assert any(p['decision_context'] == 'bodhi_update_push_stable' for p in policies)
|
| |
assert any(p['product_versions'] == ['fedora-26'] for p in policies)
|
| |
@@ -89,9 +91,7 @@
|
| |
'subject_type': 'bodhi_update',
|
| |
'subject_identifier': 'FEDORA-2018-ec7cb4d5eb',
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert 'Missing required product version' == r.json()['message']
|
| |
|
| |
@@ -104,9 +104,7 @@
|
| |
'subject_type': 'bodhi_update',
|
| |
'subject_identifier': 'FEDORA-2018-ec7cb4d5eb',
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert 'Either decision_context or rules is required.' == r.json()['message']
|
| |
|
| |
@@ -118,9 +116,7 @@
|
| |
'product_version': 'fedora-26',
|
| |
'subject_identifier': 'FEDORA-2018-ec7cb4d5eb',
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert 'Missing required "subject_type" parameter' == r.json()['message']
|
| |
|
| |
@@ -132,9 +128,7 @@
|
| |
'product_version': 'fedora-26',
|
| |
'subject_type': 'bodhi_update',
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert 'Missing required "subject_identifier" parameter' == r.json()['message']
|
| |
|
| |
@@ -146,9 +140,7 @@
|
| |
'product_version': 'fedora-26',
|
| |
'subject': 'foo-1.0.0-1.el7',
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert 'Invalid subject, must be a list of dicts' == r.json()['message']
|
| |
|
| |
@@ -157,9 +149,7 @@
|
| |
'product_version': 'fedora-26',
|
| |
'subject': ['foo-1.0.0-1.el7'],
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert 'Invalid subject, must be a list of dicts' == r.json()['message']
|
| |
|
| |
@@ -173,9 +163,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 404
|
| |
expected = ('Cannot find any applicable policies for koji_build subjects '
|
| |
'at gating point bodhi_push_update_stable in f26')
|
| |
@@ -191,9 +179,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 404
|
| |
expected = ('Cannot find any applicable policies for koji_build subjects '
|
| |
'at gating point bodhi_push_update in fedora-26')
|
| |
@@ -202,8 +188,7 @@
|
| |
|
| |
@pytest.mark.smoke
|
| |
def test_415_for_missing_request_content_type(requests_session, greenwave_server):
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- data=json.dumps({}))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json={})
|
| |
assert r.status_code == 415
|
| |
expected = "No JSON payload in request"
|
| |
assert expected == r.json()['message']
|
| |
@@ -233,9 +218,7 @@
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -262,9 +245,7 @@
|
| |
'verbose': True,
|
| |
}
|
| |
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
|
| |
@@ -303,9 +284,7 @@
|
| |
'verbose': True,
|
| |
}
|
| |
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
|
| |
@@ -337,9 +316,7 @@
|
| |
'verbose': True,
|
| |
}
|
| |
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
|
| |
@@ -369,9 +346,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -392,9 +367,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is False
|
| |
@@ -434,9 +407,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is False
|
| |
@@ -477,9 +448,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is False
|
| |
@@ -517,9 +486,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is False
|
| |
@@ -540,6 +507,31 @@
|
| |
assert res_data['unsatisfied_requirements'] == expected_unsatisfied_requirements
|
| |
|
| |
|
| |
+ def test_subject_type_group(requests_session, greenwave_server, testdatabuilder):
|
| |
+ results_item = 'sha256:' + sha256(os.urandom(50)).hexdigest()
|
| |
+
|
| |
+ testdatabuilder.create_result(
|
| |
+ item=results_item, testcase_name='testcase_name', outcome='PASSED', _type='group'
|
| |
+ )
|
| |
+ data = {
|
| |
+ 'decision_context': 'compose_test_scenario_group',
|
| |
+ 'product_version': 'fedora-30',
|
| |
+ 'subject_type': 'group',
|
| |
+ 'subject_identifier': results_item,
|
| |
+ }
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
+
|
| |
+ assert r.status_code == 200
|
| |
+
|
| |
+ res_data = r.json()
|
| |
+ assert res_data['satisfied_requirements'][0]['testcase'] == 'testcase_name'
|
| |
+ assert res_data['satisfied_requirements'][0]['type'] == 'test-result-passed'
|
| |
+ assert res_data['policies_satisfied'] is True
|
| |
+
|
| |
+ expected_summary = 'All required tests passed'
|
| |
+ assert res_data['summary'] == expected_summary
|
| |
+
|
| |
+
|
| |
def test_empty_policy_is_always_satisfied(
|
| |
requests_session, greenwave_server, testdatabuilder):
|
| |
data = {
|
| |
@@ -548,9 +540,7 @@
|
| |
'subject_type': 'bodhi_update',
|
| |
'subject_identifier': 'FEDORA-2000-abcdef01',
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -573,9 +563,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -599,10 +587,7 @@
|
| |
'subject_type': 'bodhi_update',
|
| |
'subject_identifier': 'FEDORA-2000-deadbeaf',
|
| |
}
|
| |
- r = requests_session.post(
|
| |
- greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -636,9 +621,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
# The failed result should be taken into account.
|
| |
@@ -677,9 +660,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -687,9 +668,7 @@
|
| |
data.update({
|
| |
'ignore_result': [result['id']]
|
| |
})
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
expected_unsatisfied_requirements = [
|
| |
{
|
| |
'item': {'item': nvr, 'type': 'koji_build'},
|
| |
@@ -709,9 +688,7 @@
|
| |
# ...we should get the same behaviour.
|
| |
del(data['ignore_result'])
|
| |
data['when'] = right_before_this_time(result['submit_time'])
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is False
|
| |
@@ -737,9 +714,7 @@
|
| |
'subject_type': 'compose',
|
| |
'subject_identifier': compose_id,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -774,9 +749,7 @@
|
| |
'subject_type': 'compose',
|
| |
'subject_identifier': compose_id,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is False
|
| |
@@ -816,9 +789,7 @@
|
| |
'subject_type': 'koji_build',
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
- r_ = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r_ = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r_.status_code == 200
|
| |
res_data = r_.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -826,9 +797,7 @@
|
| |
data.update({
|
| |
'ignore_waiver': [waiver['id']]
|
| |
})
|
| |
- r_ = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r_ = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r_.status_code == 200
|
| |
res_data = r_.json()
|
| |
expected_unsatisfied_requirements = [
|
| |
@@ -847,9 +816,7 @@
|
| |
# ...we should get the same behaviour.
|
| |
del(data['ignore_waiver'])
|
| |
data['when'] = right_before_this_time(waiver['timestamp'])
|
| |
- r_ = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r_ = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r_.status_code == 200
|
| |
res_data = r_.json()
|
| |
assert res_data['policies_satisfied'] is False
|
| |
@@ -886,9 +853,7 @@
|
| |
'subject_type': 'bodhi_update',
|
| |
'subject_identifier': 'FEDORA-2000-abcdef01',
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -898,9 +863,7 @@
|
| |
testdatabuilder.create_result(item=nvr,
|
| |
testcase_name=TASKTRON_RELEASE_CRITICAL_TASKS[-1],
|
| |
outcome='FAILED')
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -924,9 +887,7 @@
|
| |
'subject_type': 'bodhi_update',
|
| |
'subject_identifier': 'FEDORA-2000-abcdef01',
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
# the failed test result of dist.abicheck should be ignored and thus the policy
|
| |
@@ -947,9 +908,7 @@
|
| |
'product_version': 'rhel-something',
|
| |
'subject': [{'type': 'brew-build', 'item': nvr}],
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
# the failed test result of sci.brew-build.tier0.functiona should be ignored and thus the
|
| |
@@ -970,9 +929,7 @@
|
| |
'subject': [{'type': 'brew-build', 'item': nvr}],
|
| |
}
|
| |
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -1109,9 +1066,7 @@
|
| |
'subject_type': 'compose',
|
| |
'subject_identifier': compose_id,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert not res_data['policies_satisfied']
|
| |
@@ -1141,9 +1096,7 @@
|
| |
'subject_type': 'compose',
|
| |
'subject_identifier': compose_id,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied']
|
| |
@@ -1202,15 +1155,13 @@
|
| |
'subject_identifier': nvr,
|
| |
'verbose': True
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
expected_summary = 'All required tests passed'
|
| |
assert res_data['summary'] == expected_summary
|
| |
- res_data['results'][0]['data']['type'][0] == 'redhat-module'
|
| |
+ assert res_data['results'][0]['data']['type'][0] == 'redhat-module'
|
| |
|
| |
|
| |
def test_verbose_retrieve_latest_results(requests_session, greenwave_server, testdatabuilder):
|
| |
@@ -1228,9 +1179,7 @@
|
| |
'verbose': True
|
| |
}
|
| |
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -1268,9 +1217,7 @@
|
| |
'subject_identifier': nvr,
|
| |
}
|
| |
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -1308,9 +1255,7 @@
|
| |
'subject_identifier': nvr,
|
| |
'verbose': True,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
|
| |
@@ -1335,9 +1280,7 @@
|
| |
'verbose': True
|
| |
}
|
| |
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
assert res_data['policies_satisfied'] is True
|
| |
@@ -1367,9 +1310,7 @@
|
| |
],
|
| |
'verbose': True
|
| |
}
|
| |
- r_ = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r_ = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r_.status_code == 200
|
| |
res_data = r_.json()
|
| |
assert len(res_data['waivers']) == 1
|
| |
@@ -1392,9 +1333,7 @@
|
| |
'when': right_before_this_time(results[1]['submit_time']),
|
| |
'verbose': True,
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
|
| |
@@ -1402,9 +1341,7 @@
|
| |
assert res_data['results'] == [results[0]]
|
| |
|
| |
del data['when']
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
|
| |
@@ -1426,9 +1363,7 @@
|
| |
},
|
| |
],
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert ('Cannot have both decision_context and rules') == r.json()['message']
|
| |
|
| |
@@ -1451,9 +1386,7 @@
|
| |
},
|
| |
],
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert ('Key \'type\' is required for every rule') == r.json()['message']
|
| |
|
| |
@@ -1475,9 +1408,7 @@
|
| |
},
|
| |
],
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 400
|
| |
assert ('Key \'test_case_name\' is required if not a RemoteRule') == r.json()['message']
|
| |
|
| |
@@ -1521,9 +1452,7 @@
|
| |
},
|
| |
],
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
|
| |
@@ -1574,9 +1503,7 @@
|
| |
},
|
| |
],
|
| |
}
|
| |
- r = requests_session.post(greenwave_server + 'api/v1.0/decision',
|
| |
- headers={'Content-Type': 'application/json'},
|
| |
- data=json.dumps(data))
|
| |
+ r = requests_session.post(greenwave_server + 'api/v1.0/decision', json=data)
|
| |
assert r.status_code == 200
|
| |
res_data = r.json()
|
| |
|
| |
Signed-off-by: Valerij Maljulin vmaljuli@redhat.com