"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
"""
import pytest
from django.urls import reverse
@pytest.mark.parametrize(
'label_config, status_code',
[
(
"""
""",
204,
),
(
"""
""",
204,
),
(
"""
""",
204,
),
(
"""<<< <<< View>
<<<<< Choices /BUG /ERROR> >>>>>>>>
""",
400,
),
('some shit', 400),
(
"""
""",
400,
),
(
"""
""",
204,
),
# non-existent toName
(
"""
""",
400,
),
# toName points to tag (rect-1) without sources
(
"""
""",
204,
),
# within control tags
(
"""
""",
204,
),
],
)
@pytest.mark.django_db
def test_validate_label_config(business_client, label_config, status_code):
r = business_client.post(
reverse('projects:api:label-config-validate'),
data={'label_config': label_config},
content_type='application/json',
)
assert r.status_code == status_code