Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/api/test_sparql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

import json
from rdflib import ConjunctiveGraph, Graph, URIRef
from rdflib.namespace import RDF
from whyis.test.api_test_case import ApiTestCase

from .api_test_data import PERSON_INSTANCE_TURTLE

class TestSPARQLAPI(ApiTestCase):
turtle = PERSON_INSTANCE_TURTLE


def test_sparql_form_redirect(self):
self.login_new_user()
response = self.post_nanopub(data=self.turtle,
content_type="text/turtle",
expected_headers=["Location"])

content = self.client.get("/sparql", follow_redirects=False)

self.assertEquals(content.status,'302 FOUND')
self.assertEquals(content.headers['Location'], 'http://localhost/sparql.html')
2 changes: 1 addition & 1 deletion whyis/blueprint/sparql/sparql_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def sparql_view():
if arg.lower() == 'query':
has_query = True
if request.method == 'GET' and not has_query:
return redirect(url_for('sparql_form'))
return redirect(url_for('.sparql_form'))
#print self.db.store.query_endpoint
if request.method == 'GET':
headers = {}
Expand Down