1👍
I use wrong client. I have to use Djano REST client
from rest_framework.test import APIClient
def test_mgmt_user_remove_excel(prepare_mgmt_users):
client, response = upload_excel("John", "johnpassword")
excel_id = response.data.get('id')
url = '/api/price-list-excel-files/' + str(excel_id) + '/'
client2 = APIClient()
client2.login(username="John", password="johnpassword")
res2 = client2.delete(url)
assert 0 == PriceListExcelFile.objects.count()
👤joe
Source:stackexchange.com