зеркало из https://github.com/mozilla/treeherder.git
Bug 1644350 - Add readonly endpoint for performance tags
This commit is contained in:
Родитель
c357f875d5
Коммит
ca79f78542
|
@ -0,0 +1,14 @@
|
|||
from django.urls import reverse
|
||||
|
||||
|
||||
def test_perf_tags_get(authorized_sheriff_client, test_perf_tag, test_perf_tag_2):
|
||||
resp = authorized_sheriff_client.get(reverse('performance-tags-list'))
|
||||
assert resp.status_code == 200
|
||||
|
||||
assert len(resp.json()) == 2
|
||||
|
||||
assert resp.json()[0]['id'] == test_perf_tag.id
|
||||
assert resp.json()[0]['name'] == test_perf_tag.name
|
||||
|
||||
assert resp.json()[1]['id'] == test_perf_tag_2.id
|
||||
assert resp.json()[1]['name'] == test_perf_tag_2.name
|
|
@ -22,6 +22,7 @@ from treeherder.perf.models import (
|
|||
PerformanceDatum,
|
||||
PerformanceFramework,
|
||||
PerformanceSignature,
|
||||
PerformanceTag,
|
||||
)
|
||||
from treeherder.webapp.api.permissions import IsStaffOrReadOnly
|
||||
|
||||
|
@ -34,6 +35,7 @@ from .performance_serializers import (
|
|||
PerformanceFrameworkSerializer,
|
||||
PerformanceQueryParamsSerializer,
|
||||
PerformanceSummarySerializer,
|
||||
PerformanceTagSerializer,
|
||||
TestSuiteHealthParamsSerializer,
|
||||
TestSuiteHealthSerializer,
|
||||
)
|
||||
|
@ -384,6 +386,13 @@ class PerformanceAlertSummaryFilter(django_filters.FilterSet):
|
|||
]
|
||||
|
||||
|
||||
class PerformanceTagViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = PerformanceTag.objects.all()
|
||||
serializer_class = PerformanceTagSerializer
|
||||
filter_backends = [filters.OrderingFilter]
|
||||
ordering = 'id'
|
||||
|
||||
|
||||
class PerformanceAlertSummaryViewSet(viewsets.ModelViewSet):
|
||||
"""ViewSet for the performance alert summary model"""
|
||||
|
||||
|
|
|
@ -105,6 +105,9 @@ default_router.register(r'user', refdata.UserViewSet, basename='user')
|
|||
default_router.register(
|
||||
r'machineplatforms', machine_platforms.MachinePlatformsViewSet, basename='machineplatforms'
|
||||
)
|
||||
default_router.register(
|
||||
r'performance/tag', performance_data.PerformanceTagViewSet, basename='performance-tags'
|
||||
)
|
||||
default_router.register(
|
||||
r'performance/alertsummary',
|
||||
performance_data.PerformanceAlertSummaryViewSet,
|
||||
|
|
Загрузка…
Ссылка в новой задаче