'Tests creating and updating external documents.'

def test_create_document_url_view(self):

    self.client.login(username='admin', password='admin')
    form_data = {'title': 'GeoNode    Map', 'permissions': '{"users":{"AnonymousUser":    ["view_resourcebase"]},"groups":{}}', 'doc_url': 'http://www.geonode.org/map.pdf'}
    response = self.client.post(reverse('document_upload'), data=form_data)
    self.assertEqual(response.status_code, 302)
    d = Document.objects.get(title='GeoNode    Map')
    self.assertEqual(d.doc_url, 'http://www.geonode.org/map.pdf')
    form_data['doc_url'] = 'http://www.geonode.org/mapz.pdf'
    response = self.client.post(reverse('document_replace', args=[d.id]), data=form_data)
    self.assertEqual(response.status_code, 302)
    d = Document.objects.get(title='GeoNode    Map')
    self.assertEqual(d.doc_url, 'http://www.geonode.org/mapz.pdf')
