def test_graph_retrieve_None(self):
     """Test graph retrieve non-existent graph."""
     responses.add(responses.GET,
                   "{0}/data?graph={1}".format(self.request_address,
                                               "http://test.com"),
                   status=404)
     fuseki = GraphStore()
     result = fuseki._graph_retrieve("default")
     self.assertIsNone(result)
 def on_get(self, req, resp):
     """Execution of the GET named graph request."""
     graph_uri = req.get_param('uri')
     fuseki = GraphStore()
     response = fuseki._graph_retrieve(graph_uri)
     if response is not None:
         resp.data = str(response)
         resp.content_type = 'text/turtle'
         app_logger.info('Retrieved: {0}.'.format(graph_uri))
         resp.status = falcon.HTTP_200
     else:
         raise falcon.HTTPGone()
 def test_graph_retrieve_ttl(self):
     """Test graph retrieve a specific graph."""
     with open('tests/resources/graph_strategy.ttl') as datafile:
         graph_data = datafile.read()
     url = "http://data.hulib.helsinki.fi/attx/strategy"
     responses.add(responses.GET,
                   "{0}/data?graph={1}".format(self.request_address, url),
                   body=graph_data,
                   status=200)
     fuseki = GraphStore()
     result = fuseki._graph_retrieve(
         "http://data.hulib.helsinki.fi/attx/strategy")
     assert (result == graph_data)
 def test_graph_retrieve_bad(self):
     """Test ConnectionError graph retrieve on graph endpoint."""
     fuseki = GraphStore()
     with self.assertRaises(ConnectionError):
         fuseki._graph_retrieve("default")