Python formatting

This commit is contained in:
Mouse Reeve 2021-04-12 15:09:50 -07:00
parent a907dfdce7
commit 822e2e1a93
2 changed files with 4 additions and 5 deletions

View file

@ -145,11 +145,12 @@ class FederationViews(TestCase):
view = views.ImportServerBlocklist.as_view() view = views.ImportServerBlocklist.as_view()
request = self.factory.post( request = self.factory.post(
"", { "",
{
"json_file": SimpleUploadedFile( "json_file": SimpleUploadedFile(
"file.json", open("file.json", "rb").read() "file.json", open("file.json", "rb").read()
) )
} },
) )
request.user = self.local_user request.user = self.local_user
request.user.is_superuser = True request.user.is_superuser = True

View file

@ -79,9 +79,7 @@ class ImportServerBlocklist(View):
def post(self, request): def post(self, request):
""" add a server from the admin panel """ """ add a server from the admin panel """
json_data = json.load( json_data = json.load(request.FILES["json_file"])
request.FILES["json_file"]
)
failed = [] failed = []
success_count = 0 success_count = 0
for item in json_data: for item in json_data: