'Editing a translated doc keeps the correct slug'

def test_slug_translate(self):

    self.client.login(username='admin', password='testpass')
    original_slug = 'eng-doc'
    child_slug = 'child-eng-doc'
    foreign_locale = 'es'
    foreign_slug = 'es-doc'
    foreign_child_slug = 'child-es-doc'
    en_doc = document(title='Eng    Doc', slug=original_slug, is_localizable=True, locale=settings.WIKI_DEFAULT_LANGUAGE)
    en_doc.save()
    r = revision(document=en_doc)
    r.save()
    parent_data = new_document_data()
    parent_data['title'] = 'ES    Doc'
    parent_data['slug'] = foreign_slug
    parent_data['content'] = 'This    is    the    content'
    parent_data['is_localizable'] = True
    parent_data['form'] = 'both'
    translate_url = reverse('wiki.document', args=[original_slug], locale=settings.WIKI_DEFAULT_LANGUAGE)
    translate_url += ('$translate?tolocale=' + foreign_locale)
    response = self.client.post(translate_url, parent_data)
    doc_url = reverse('wiki.document', args=[foreign_slug], locale=foreign_locale)
    params = {'rev_saved': ''}
    doc_url = ('%s?%s' % (doc_url, urlencode(params)))
    self.assertRedirects(response, doc_url)
    response = self.client.get(reverse('wiki.edit', args=[foreign_slug], locale=foreign_locale))
    page = pq(response.content)
    eq_(page.find('input[name=slug]')[0].value, foreign_slug)
    en_doc = document(title='Child    Eng    Doc', slug=((original_slug + '/') + child_slug), is_localizable=True, locale=settings.WIKI_DEFAULT_LANGUAGE, parent_topic=en_doc)
    en_doc.save()
    r = revision(document=en_doc)
    r.save()
    child_data = new_document_data()
    child_data['title'] = 'ES    Child    Doc'
    child_data['slug'] = foreign_child_slug
    child_data['content'] = 'This    is    the    content'
    child_data['is_localizable'] = True
    child_data['form'] = 'both'
    translate_url = reverse('wiki.document', args=[((original_slug + '/') + child_slug)], locale=settings.WIKI_DEFAULT_LANGUAGE)
    translate_url += ('$translate?tolocale=' + foreign_locale)
    response = self.client.post(translate_url, child_data)
    slug = ((foreign_slug + '/') + child_data['slug'])
    doc_url = reverse('wiki.document', args=[slug], locale=foreign_locale)
    params = {'rev_saved': ''}
    doc_url = ('%s?%s' % (doc_url, urlencode(params)))
    self.assertRedirects(response, doc_url)
