4👍
✅
Solved it by reading the docs more closely, if no content type is passed to the post method it automatically sets multipart/form-data, which my view accepted.
Changes:
invoice = {
"invoicefile":(open(full_filename, "rb")),
"debtor":"5560360793",
"amount":"55000",
"serial":"1234567890",
"dateout":"20180728",
"expiration":"20180808",
}
response = self.client.post(reverse("invoiceupload"), invoice)
self.assertEqual(response.status_code, 201)
Source:stackexchange.com