mirror of
https://github.com/ansible/awx.git
synced 2026-01-20 14:11:24 -03:30
Fix the tests to conform to the new Insights results
This commit is contained in:
parent
6dae4a1d6d
commit
e2861c6c39
File diff suppressed because one or more lines are too long
@ -4,6 +4,9 @@ import os
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
with open(os.path.join(dir_path, 'insights_hosts.json')) as data_file:
|
||||
TEST_INSIGHTS_HOSTS = json.load(data_file)
|
||||
|
||||
with open(os.path.join(dir_path, 'insights.json')) as data_file:
|
||||
TEST_INSIGHTS_PLANS = json.load(data_file)
|
||||
|
||||
|
||||
12
awx/main/tests/data/insights_hosts.json
Normal file
12
awx/main/tests/data/insights_hosts.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"total": 1,
|
||||
"count": 1,
|
||||
"page": 1,
|
||||
"per_page": 50,
|
||||
"results": [
|
||||
{
|
||||
"insights_id": "11111111-1111-1111-1111-111111111111",
|
||||
"updated": "2019-03-19T21:59:09.213151-04:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -3,11 +3,12 @@
|
||||
|
||||
|
||||
from awx.main.utils.insights import filter_insights_api_response
|
||||
from awx.main.tests.data.insights import TEST_INSIGHTS_PLANS, TEST_INSIGHTS_REMEDIATIONS
|
||||
from awx.main.tests.data.insights import TEST_INSIGHTS_HOSTS, TEST_INSIGHTS_PLANS, TEST_INSIGHTS_REMEDIATIONS
|
||||
|
||||
|
||||
def test_filter_insights_api_response():
|
||||
actual = filter_insights_api_response(TEST_INSIGHTS_PLANS, TEST_INSIGHTS_REMEDIATIONS)
|
||||
actual = filter_insights_api_response(
|
||||
TEST_INSIGHTS_HOSTS['results'][0], TEST_INSIGHTS_PLANS, TEST_INSIGHTS_REMEDIATIONS)
|
||||
|
||||
assert actual['last_check_in'] == '2019-03-19T21:59:09.213151-04:00'
|
||||
assert len(actual['reports']) == 5
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
|
||||
# Old Insights API -> New API
|
||||
#
|
||||
# last_check_in -> checked_on
|
||||
# reports[] -> active_reports[]
|
||||
# reports[].rule.{description,summary} -> active_reports[].rule.{description,summary}
|
||||
# reports[].rule.category -> active_reports[].rule.category.name
|
||||
# reports[].rule.severity (str) -> active_reports[].rule.total_risk (int)
|
||||
# last_check_in is missing entirely, is now provided by a different endpoint
|
||||
# reports[] -> []
|
||||
# reports[].rule.{description,summary} -> [].rule.{description,summary}
|
||||
# reports[].rule.category -> [].rule.category.name
|
||||
# reports[].rule.severity (str) -> [].rule.total_risk (int)
|
||||
|
||||
# reports[].rule.{ansible,ansible_fix} appears to be unused
|
||||
# reports[].maintenance_actions[] missing entirely, is now provided
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user