human
Complete the below
@pytest.mark.django_db
def test_save_document_integrity_error():

    ''''Can save ca/docs/Project:Quant_a, despite IntegrityError.'
    '''
assistant
#Here is the Python code you requested.
    en_root_doc = Document.objects.create(locale=u'en-US', slug=u'MDN', title=u'MDN')
    en_doc = Document.objects.create(locale=u'en-US', slug=u'MDN/About', title=u'About    MDN', parent_topic=en_root_doc)
    ca_id = 1000
    while Document.objects.filter(id=ca_id).exists():
        ca_id += 1
    ca_data = {u'locale': u'ca', u'slug': u'Project:Quant_a', u'title': u'Quant    a', u'parent': en_doc, u'id': ca_id}
    def ca_weirdness(**data):
        ca_doc = Document()
        for (name, value) in data.items():
            setattr(ca_doc, name, value)
        ca_doc.save()
        raise IntegrityError(u'ID    in    use')
    with mock.patch(u'kuma.scrape.storage.Document.objects.create') as mcreate:
        mcreate.side_effect = ca_weirdness
        Storage().save_document(ca_data)
    mcreate.assert_called_once_with(**ca_data)
    ca_doc = Document.objects.get(locale=u'ca', slug=u'Project:Quant_a')
    assert (ca_doc.title == u'Quant    a')
    assert (ca_doc.parent == en_doc)