i am doing unit tests on my rest framework API, my model:
class attach():
attachment = models.ImageField
name = models.CharField
then i attempt to post to is via the API i defined(standard serializer not shown here)
c = Client()
with open('wishlist.doc') as fp:
c.post('/customers/wishes/', {'name': 'fred', 'attachment': fp}, format='multipart')
i get the following stack trace
ValueError: The 'attachment' attribute has no file associated with it.
how do i associate the key attachment with the file