'Simulate a file upload and check how many times Model.save() gets
called.'

def testBug639(self):

    filename = os.path.join(os.path.dirname(upath(__file__)), 'test.jpg')
    with open(filename, 'rb') as fp:
        img = fp.read()
    data = {'title': 'Testing'}
    files = {'image': SimpleUploadedFile('test.jpg', img, 'image/jpeg')}
    form = PhotoForm(data=data, files=files)
    p = form.save()
    self.assertEqual(p._savecount, 1)
