'Test that the file storage method will create a unique filename if the file already exists.'

def test_unique_filenames(self):

    requested_file_name = 'nonunique_store'
    file_content = 'copy'
    self.request.FILES = {'nonunique_file': SimpleUploadedFile('nonunique.txt', file_content)}
    (_, first_stored_file_name) = store_uploaded_file(self.request, 'nonunique_file', ['.txt'], requested_file_name, self.default_max_size)
    self.request.FILES = {'nonunique_file': SimpleUploadedFile('nonunique.txt', file_content)}
    (file_storage, second_stored_file_name) = store_uploaded_file(self.request, 'nonunique_file', ['.txt'], requested_file_name, self.default_max_size)
    self.assertNotEqual(first_stored_file_name, second_stored_file_name)
    self.assertIn(requested_file_name, second_stored_file_name)
    self._verify_successful_upload(file_storage, second_stored_file_name, file_content)
