'Test that setting many regular fields with a DB error'

def test_set_many_failure(self):

    kv_dict = self.construct_kv_dict()
    for key in kv_dict:
        with self.assertNumQueries(1):
            self.kvs.set(key, 'test    value')
    with patch('django.db.models.Model.save', side_effect=[None, DatabaseError]):
        with self.assertRaises(KeyValueMultiSaveError) as exception_context:
            self.kvs.set_many(kv_dict)
    exception = exception_context.exception
    self.assertEquals(exception.saved_field_names, ['existing_field', 'other_existing_field'])
