'Test translating based on a non-current revision.'

def test_translate_no_update_based_on(self):

    base_es_rev = self._create_and_approve_first_translation()
    es_doc = base_es_rev.document
    enUS_doc = es_doc.parent
    base_es_rev.based_on = enUS_doc.current_revision
    base_es_rev.save()
    r = ApprovedRevisionFactory(document=es_doc.parent, is_ready_for_localization=True)
    url = reverse('wiki.edit_document', locale='es', args=[es_doc.slug])
    data = _translation_data()
    data['form'] = 'rev'
    data['based_on'] = enUS_doc.current_revision_id
    data['no-update'] = 'Yes'
    self.client.post(url, data)
    new_es_rev = es_doc.revisions.order_by('-id')[0]
    eq_(base_es_rev.based_on_id, new_es_rev.based_on_id)
    del data['no-update']
    self.client.post(url, data)
    new_es_rev = es_doc.revisions.order_by('-id')[0]
    eq_(r.id, new_es_rev.based_on_id)
