Skip to content

Commit

Permalink
Fixup. Format code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Apr 29, 2024
1 parent 924af8a commit 3698912
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 33 deletions.
12 changes: 3 additions & 9 deletions pod/dressing/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ def test_video_encoding_in_progress(self):
self.assertEqual(response.status_code, 403)
self.assertEqual(len(messages), 1)
self.assertEqual(messages[0].tags, "error")
self.assertEqual(
messages[0].message, _("The video is currently being encoded.")
)
self.assertEqual(messages[0].message, _("The video is currently being encoded."))
print(" ---> test_video_encoding_in_progress ok")

def test_video_dressing_permission_denied(self):
Expand All @@ -93,9 +91,7 @@ def test_video_dressing_permission_denied(self):
self.assertEqual(response.status_code, 403)
self.assertEqual(len(messages), 1)
self.assertEqual(messages[0].tags, "error")
self.assertEqual(
messages[0].message, _("You cannot dress this video.")
)
self.assertEqual(messages[0].message, _("You cannot dress this video."))
print(" ---> test_video_dressing_permission_denied ok")


Expand Down Expand Up @@ -158,9 +154,7 @@ def test_my_dressing_permission_denied(self):
self.assertEqual(response.status_code, 403)
self.assertEqual(len(messages), 1)
self.assertEqual(messages[0].tags, "error")
self.assertEqual(
messages[0].message, _("You cannot access this page.")
)
self.assertEqual(messages[0].message, _("You cannot access this page."))
print(" ---> test_my_dressing_permission_denied ok")


Expand Down
29 changes: 5 additions & 24 deletions pod/dressing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ def video_dressing(request, slug):

dressings = get_dressings(request.user, request.user.owner.accessgroup_set.all())

if not (
request.user.is_superuser
or request.user.is_staff
):
if not (request.user.is_superuser or request.user.is_staff):
messages.add_message(request, messages.ERROR, _("You cannot dress this video."))
raise PermissionDenied

Expand Down Expand Up @@ -81,12 +78,7 @@ def dressing_edit(request, dressing_id):
"""Edit a dressing object."""
dressing_edit = get_object_or_404(Dressing, id=dressing_id)

if dressing_edit and (
not (
request.user.is_superuser
or request.user.is_staff
)
):
if dressing_edit and (not (request.user.is_superuser or request.user.is_staff)):
messages.add_message(request, messages.ERROR, _("You cannot edit this dressing."))
raise PermissionDenied

Expand Down Expand Up @@ -125,10 +117,7 @@ def dressing_edit(request, dressing_id):
@login_required(redirect_field_name="referrer")
def dressing_create(request):
"""Create a dressing object."""
if not (
request.user.is_superuser
or request.user.is_staff
):
if not (request.user.is_superuser or request.user.is_staff):
messages.add_message(
request, messages.ERROR, _("You cannot create a video dressing.")
)
Expand Down Expand Up @@ -161,12 +150,7 @@ def dressing_delete(request, dressing_id):
if in_maintenance():
return redirect(reverse("maintenance"))

if dressing and (
not (
request.user.is_superuser
or request.user.is_staff
)
):
if dressing and (not (request.user.is_superuser or request.user.is_staff)):
messages.add_message(
request, messages.ERROR, _("You cannot delete this dressing.")
)
Expand Down Expand Up @@ -207,10 +191,7 @@ def my_dressings(request):
if in_maintenance():
return redirect(reverse("maintenance"))

if not (
request.user.is_superuser
or request.user.is_staff
):
if not (request.user.is_superuser or request.user.is_staff):
messages.add_message(request, messages.ERROR, _("You cannot access this page."))
raise PermissionDenied

Expand Down

0 comments on commit 3698912

Please sign in to comment.