Add play filtering by uuid
Change-Id: I8ec1fdd6d79838dc64e519e0c8ae9b5c5fb22524
This commit is contained in:
parent
70f248c24f
commit
864e0b481b
@ -96,6 +96,13 @@ class PlayTestCase(APITestCase):
|
||||
self.assertEqual(1, len(request.data["results"]))
|
||||
self.assertEqual(play.name, request.data["results"][0]["name"])
|
||||
|
||||
def test_get_play_by_uuid(self):
|
||||
play = factories.PlayFactory(name="play1", uuid="6b838b6f-cfc7-4e11-a264-73df8683ee0e")
|
||||
factories.PlayFactory(name="play2")
|
||||
request = self.client.get("/api/v1/plays?uuid=6b838b6f-cfc7-4e11-a264-73df8683ee0e")
|
||||
self.assertEqual(1, len(request.data["results"]))
|
||||
self.assertEqual(play.name, request.data["results"][0]["name"])
|
||||
|
||||
def test_get_play_duration(self):
|
||||
started = timezone.now()
|
||||
ended = started + datetime.timedelta(hours=1)
|
||||
|
@ -49,7 +49,7 @@ class PlayViewSet(viewsets.ModelViewSet):
|
||||
queryset = models.Play.objects.all()
|
||||
serializer_class = serializers.PlaySerializer
|
||||
filter_backends = (DjangoFilterBackend,)
|
||||
filter_fields = ("playbook",)
|
||||
filter_fields = ("playbook", "uuid")
|
||||
|
||||
|
||||
class TaskViewSet(viewsets.ModelViewSet):
|
||||
|
Loading…
Reference in New Issue
Block a user