예제 #1
0
    def test_want_html(self):
        for mimetype in 'text/html', 'application/xhtml+xml':
            headers = {'accept': mimetype}
            with self.app.test_request_context(headers=headers):
                self.assertFalse(want_rdf())

        with self.app.test_request_context():
            self.assertFalse(want_rdf())
예제 #2
0
파일: test_rdf.py 프로젝트: odtvince/udata
    def test_want_html(self):
        for mimetype in 'text/html', 'application/xhtml+xml':
            headers = {'accept': mimetype}
            with self.app.test_request_context(headers=headers):
                self.assertFalse(want_rdf())

        with self.app.test_request_context():
            self.assertFalse(want_rdf())
예제 #3
0
 def dispatch_request(self, *args, **kwargs):
     if want_rdf():
         fmt = RDF_EXTENSIONS[negociate_content()]
         url = url_for('datasets.rdf_format',
                       dataset=kwargs['dataset'].id, format=fmt)
         return redirect(url)
     return super(DatasetDetailView, self).dispatch_request(*args, **kwargs)
예제 #4
0
 def test_want_rdf(self):
     for mimetype in 'application/xml', 'application/json':
         headers = {'accept': mimetype}
         with self.app.test_request_context(headers=headers):
             self.assertTrue(want_rdf())
예제 #5
0
파일: test_rdf.py 프로젝트: odtvince/udata
 def test_want_rdf(self):
     for mimetype in 'application/xml', 'application/json':
         headers = {'accept': mimetype}
         with self.app.test_request_context(headers=headers):
             self.assertTrue(want_rdf())