8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Add missing topologie/server endpoint

This commit is contained in:
Maël Kervella 2018-06-20 12:13:23 +00:00
parent 1951ab467d
commit 6d5a9dc314
4 changed files with 19 additions and 0 deletions

View file

@ -400,6 +400,14 @@ class SwitchSerializer(NamespacedHMSerializer):
'stack_member_id', 'model', 'switchbay', 'api_url')
class ServerSerializer(NamespacedHMSerializer):
"""Serialize `topologie.models.Server` objects
"""
class Meta:
model = topologie.Server
fields = ('user', 'name', 'active', 'api_url')
class ModelSwitchSerializer(NamespacedHMSerializer):
"""Serialize `topologie.models.ModelSwitch` objects
"""

View file

@ -120,6 +120,8 @@ class APIEndpointsTestCase(APITestCase):
# '/api/topologie/modelswitch/<pk>/',
'/api/topologie/room/',
# '/api/topologie/room/<pk>/',
'/api/topologie/server/',
# '/api/topologie/server/<pk>/',
'/api/topologie/stack/',
# '/api/topologie/stack/<pk>/',
'/api/topologie/switch/',
@ -362,6 +364,7 @@ class APIPaginationTestCase(APITestCase):
'/api/topologie/constructorswitch/',
'/api/topologie/modelswitch/',
'/api/topologie/room/',
'/api/topologie/server/',
'/api/topologie/stack/',
'/api/topologie/switch/',
'/api/topologie/switchbay/',

View file

@ -73,6 +73,7 @@ router.register_view(r'preferences/mailmessageoption', views.MailMessageOptionVi
router.register_viewset(r'topologie/stack', views.StackViewSet)
router.register_viewset(r'topologie/acesspoint', views.AccessPointViewSet)
router.register_viewset(r'topologie/switch', views.SwitchViewSet)
router.register_viewset(r'topologie/server', views.ServerViewSet)
router.register_viewset(r'topologie/modelswitch', views.ModelSwitchViewSet)
router.register_viewset(r'topologie/constructorswitch', views.ConstructorSwitchViewSet)
router.register_viewset(r'topologie/switchbay', views.SwitchBayViewSet)

View file

@ -339,6 +339,13 @@ class SwitchViewSet(viewsets.ReadOnlyModelViewSet):
serializer_class = serializers.SwitchSerializer
class ServerViewSet(viewsets.ReadOnlyModelViewSet):
"""Exposes list and details of `topologie.models.Server` objects.
"""
queryset = topologie.Server.objects.all()
serializer_class = serializers.ServerSerializer
class ModelSwitchViewSet(viewsets.ReadOnlyModelViewSet):
"""Exposes list and details of `topologie.models.ModelSwitch` objects.
"""