Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_projection(self, mock_get):
mock_get.return_value = self.setMockGetResponse()
rq, _ = self.loader.getTextForName('test-projection')
resp, status, headers = utils.dispatchSPARQLQuery(rq, self.loader, content=None, requestArgs={'id': 'http://dbpedia.org/resource/Frida_Kahlo'},
acceptHeader='application/json',
requestUrl='http://mock-endpoint/sparql', formData={})
self.validateTestResponse(resp)
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])
"xml:lang": "en",
"value": "xsd:boolean"
}
}]
}
}
mock_get.return_value = Mock(ok=True)
mock_get.return_value.headers = {'Content-Type': 'application/json'}
mock_get.return_value.text = json.dumps(mock_json)
rq, _ = self.loader.getTextForName('test-json')
self.assertIn('proto', rq)
resp, status, headers = utils.dispatchSPARQLQuery(rq, self.loader, content=None, requestArgs={},
acceptHeader='application/json',
requestUrl='http://mock-endpoint/sparql', formData={})
self.assertEqual(status, 200)
self.assertIsInstance(resp, list)
self.assertIn('http', resp[0]['id'])