def on_delete(self, req, resp):
     """Execution of the DELETE named graph request."""
     graph_uri = req.get_param('uri')
     fuseki = GraphStore()
     fuseki._drop_graph(graph_uri)
     resp.content_type = 'plain/text'
     app_logger.info(
         'Deleted/DELETE graph with URI: {0}.'.format(graph_uri))
     resp.status = falcon.HTTP_200
    def test_graph_drop(self):
        """Test drop graph."""
        url = "http://data.hulib.helsinki.fi/attx/strategy"
        with open('tests/resources/graph_drop.txt') as datafile:
            graph_data = datafile.read()

        def request_callback(request):
            """Request callback for drop graph."""
            headers = {
                'content-type': 'text/html',
                'cache-control': "no-cache"
            }
            return (200, headers, graph_data)

        responses.add_callback(
            responses.POST,
            "{0}/update".format(self.request_address),
            callback=request_callback,
            content_type="application/x-www-form-urlencoded",
        )
        fuseki = GraphStore()
        result = fuseki._drop_graph(url)
        assert (result == graph_data)
 def test_graph_drop_bad(self):
     """Test ConnectionError graph drop on graph endpoint."""
     fuseki = GraphStore()
     with self.assertRaises(ConnectionError):
         fuseki._drop_graph("default")