Я использую pytest для тестирования загрузки файлов в django, и у меня есть эта функция
Код: Выделить всё
def test_file_upload(self):
# file_content is a bytest object
request = client.patch(
"/fake-url/",
json.dumps({"file" : file_content}),
content_type="application/json",
)
Подробнее здесь: https://stackoverflow.com/questions/747 ... -in-pytest