mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 18:21:03 -03:30
Allow DRF parser to accept trailing commas.
This commit is contained in:
15
awx/main/tests/unit/api/test_parsers.py
Normal file
15
awx/main/tests/unit/api/test_parsers.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pytest
|
||||
|
||||
from awx.api.parsers import _remove_trailing_commas
|
||||
|
||||
|
||||
@pytest.mark.parametrize('input_, output', [
|
||||
('{"foo": "bar"}', '{"foo": "bar"}'),
|
||||
('{"foo": "bar",\n\t\r }', '{"foo": "bar"}'),
|
||||
('{"foo": ["alice", "bob"]}', '{"foo": ["alice","bob"]}'),
|
||||
('{"foo": ["alice", "bob",\n\t\r ]}', '{"foo": ["alice","bob"]}'),
|
||||
('{"foo": "\\"bar,\n\t\r }"}', '{"foo": "\\"bar,\n\t\r }"}'),
|
||||
('{"foo": ["\\"alice,\n\t\r ]", "bob"]}', '{"foo": ["\\"alice,\n\t\r ]","bob"]}'),
|
||||
])
|
||||
def test_remove_trailing_commas(input_, output):
|
||||
assert _remove_trailing_commas(input_) == output
|
||||
Reference in New Issue
Block a user