def test_get_annotation_as_html(self):
     response = test_insert_anotation(self,
                       http_accept='application/rdf+xml', 
                       content_type='text/turtle', 
                       data=turtle_usecase1)        
     
     anno_uri = extract_annotation_uri(response.content)
     annoid = anno_uri[anno_uri.rfind('/') + 1 : ]
     
     request = _prepare_get(self.factory, '/resource/%s' % annoid)
     request.META['HTTP_ACCEPT'] = "text/html"
     response = process_resource(request, resource_id = annoid)
     self.assert_(response.status_code == 303, 
                  "HTTPResponse has status_code: %s" % response.status_code)
     
     location = response._headers.get('location', ('Location', None))[1]
     self.assert_('/page' in location, "Wrong 303 to %s" % location)
     
     request = _prepare_get(self.factory, location)
     request.META['HTTP_ACCEPT'] = "text/html"
     response = process_page(request, resource_id = annoid)
     
     
     self.assert_(response.status_code == 200, "HTTPResponse has status_code: %s" % response.status_code)
     print response
     return response
 def test_insert_anotation(self):
     response = insert(self.factory.post('/insert/annotation',
                                         content_type='text/turtle',
                                         data=turtle_usecase1,
                                         HTTP_ACCEPT = 'application/rdf+xml'))        
     
     self.assert_(response.status_code == 200, "HTTPResponse has status_code: %s" % response.status_code)
     
     anno_uri = self.extract_annotation_uri(response.content)
     annoid = anno_uri[anno_uri.rfind('/') + 1 : ]
     
     request = self._prepare_get('/resource/%s' % annoid)
     request.META['HTTP_ACCEPT'] = "text/html"
     response = process_page(request, resource_id = annoid)
     print response
     return response