Commit 6d5a9dc3 authored by Maël Kervella's avatar Maël Kervella

Add missing topologie/server endpoint

parent 1951ab46
......@@ -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
"""
......
......@@ -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/',
......
......@@ -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)
......
......@@ -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.
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment