[Django]-How to write unit test for file upload class in django?

4👍

You can use the test client from Django. It’s very easy to use.

Example from Django docs:

>>> c = Client()
>>> with open('wishlist.doc') as fp:
...     c.post('/customers/wishes/', {'name': 'fred', 'attachment': fp})

0👍

You could try mocking what you need with something like this.

Leave a comment