mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 06:26:00 -03:30
Fix the test_export_system_auditor collection test
This commit is contained in:
@@ -134,21 +134,17 @@ def test_export_simple(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_export_system_auditor(run_module, schedule, system_auditor): # noqa: F811
|
def test_export_system_auditor(run_module, organization, system_auditor): # noqa: F811
|
||||||
"""
|
"""
|
||||||
This test illustrates that deficiency of export when ran as non-root user (i.e. system auditor).
|
This test illustrates that export of resources can now happen
|
||||||
The OPTIONS endpoint does NOT return POST for a system auditor. This is bad for the export code
|
when ran as non-root user (i.e. system auditor). The OPTIONS
|
||||||
because it relies on crawling the OPTIONS POST response to determine the fields to export.
|
endpoint does NOT return POST for a system auditor, but now we
|
||||||
|
make a best-effort to parse the description string, which will
|
||||||
|
often have the fields.
|
||||||
"""
|
"""
|
||||||
result = run_module('export', dict(all=True), system_auditor)
|
result = run_module('export', dict(all=True), system_auditor)
|
||||||
assert result.get('failed', False), result.get('msg', result)
|
assert not result.get('failed', False), result.get('msg', result)
|
||||||
|
assert 'msg' not in result
|
||||||
|
assert 'assets' in result
|
||||||
|
|
||||||
assert 'Failed to export assets substring not found' in result['msg'], (
|
find_by(result['assets'], 'organizations', 'name', 'Default')
|
||||||
'If you found this error then you have probably fixed a feature! The export code attempts to assertain the POST fields from the `description` field,'
|
|
||||||
' but both the API side and the client inference code are lacking.'
|
|
||||||
)
|
|
||||||
|
|
||||||
# r = result['assets']['schedules'][0]
|
|
||||||
# assert r['natural_key']['name'] == 'test-sched'
|
|
||||||
|
|
||||||
# assert 'rrule' not in r, 'If you found this error then you have probably fixed a feature! We WANT rrule to be found in the export schedule payload.'
|
|
||||||
|
|||||||
Reference in New Issue
Block a user