Merge pull request #1942 from ryanpetrello/fix-1939

allow any authenticated user to access the schedule preview API endpoint
This commit is contained in:
Ryan Petrello 2018-05-24 06:27:31 -04:00 committed by GitHub
commit 1ea4ef8778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -720,6 +720,7 @@ class SchedulePreview(GenericAPIView):
model = Schedule
view_name = _('Schedule Recurrence Rule Preview')
serializer_class = SchedulePreviewSerializer
permission_classes = (IsAuthenticated,)
def post(self, request):
serializer = self.get_serializer(data=request.data)

View File

@ -87,6 +87,12 @@ def test_invalid_rrules(post, admin_user, project, inventory, rrule, error):
assert error in resp.content
@pytest.mark.django_db
def test_normal_users_can_preview_schedules(post, alice):
url = reverse('api:schedule_rrule')
post(url, {'rrule': get_rrule()}, alice, expect=200)
@pytest.mark.django_db
def test_utc_preview(post, admin_user):
url = reverse('api:schedule_rrule')