How to use the grlc.gquery.guess_endpoint_uri function in grlc

To help you get started, we’ve selected a few grlc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CLARIAH / grlc / tests / test_gquery.py View on Github external
def test_guess_endpoint(self):
        with self.app.test_request_context('/?endpoint=http://url-endpoint/from-url/sparql'):
            endpoint, _ = gquery.guess_endpoint_uri('', self.loader)
            self.assertIn('from-url', endpoint,
                          'Should match endpoint given in url')

        with self.app.test_request_context('/'):
            endpoint, _ = gquery.guess_endpoint_uri('', self.loader)
            self.assertIn('from-file', endpoint,
                          'Should match endpoint in endpoint.txt')

            rq, _ = self.loader.getTextForName('test-rq')
            endpoint, _ = gquery.guess_endpoint_uri(rq, self.loader)
            self.assertIn('from-decorator', endpoint,
                          'Should match endpoint in test-rq.rq')
github CLARIAH / grlc / tests / test_gquery.py View on Github external
def test_sparql_transformer(self):
        rq, _ = self.loader.getTextForName('test-json')

        endpoint, _ = gquery.guess_endpoint_uri(rq, self.loader)
        self.assertEqual('http://dbpedia.org/sparql', endpoint, 'Should match endpoint in test-json.json')

        resp, status, headers = utils.dispatchSPARQLQuery(rq, self.loader, content=None, requestArgs={},
                                                          acceptHeader='application/json',
                                                          requestUrl='http://', formData={})
        self.assertEqual(status, 200)
        self.assertIsInstance(resp, list)
        self.assertIn('id', resp[0])