Verified Commit 8f7d923f authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: json

parent fb816bcd
......@@ -42,7 +42,7 @@ def teardown_module():
def test_switch():
db.get_connection()._delegate_connection._media_type="video/quicktime"
db.get_connection()._delegate_connection._media_type = "video/quicktime"
with raises(ClientErrorException) as cm:
execute_query("FIND Test")
assert cm.value.status == 406
......@@ -61,7 +61,8 @@ def test_retrieve_json():
def test_any():
configure_connection(media_type="text/xml")
admin.set_server_property("AUTH_OPTIONAL", "TRUE")
request = Request("https://localhost:44301/Entity", headers={"Accept": "*/*"}, method="GET")
request = Request("https://localhost:44301/Entity",
headers={"Accept": "*/*"}, method="GET")
response = urlopen(request, cafile="/home/tf/ssl/timm_root_ca.crt")
# only works with anonymous user
assert response.status == 200
......@@ -69,7 +70,8 @@ def test_any():
def test_xml():
request = Request("https://localhost:44301/Entity", headers={"Accept": "text/xml"}, method="GET")
request = Request("https://localhost:44301/Entity",
headers={"Accept": "text/xml"}, method="GET")
response = urlopen(request, cafile="/home/tf/ssl/timm_root_ca.crt")
# only works with anonymous user
assert response.status == 200
......@@ -77,15 +79,18 @@ def test_xml():
def test_json():
request = Request("https://localhost:44301/Entity", headers={"Accept": "application/json"}, method="GET")
request = Request("https://localhost:44301/Entity",
headers={"Accept": "application/json"}, method="GET")
response = urlopen(request, cafile="/home/tf/ssl/timm_root_ca.crt")
# only works with anonymous user
assert response.status == 200
assert response.getheader("Content-Type") == "application/json;charset=utf-8"
assert response.getheader(
"Content-Type") == "application/json;charset=utf-8"
def test_shockwave_not_acceptable():
request = Request("https://localhost:44301/Entity", headers={"Accept": "application/x-shockwave-flash"}, method="GET")
request = Request("https://localhost:44301/Entity",
headers={"Accept": "application/x-shockwave-flash"}, method="GET")
with raises(HTTPError) as cm:
response = urlopen(request, cafile="/home/tf/ssl/timm_root_ca.crt")
assert cm.value.code == 406
......@@ -559,11 +559,8 @@ def test_ticket_241():
q = h.Query("FIND RECORD WHICH HAS been created by some*")
q.execute(raise_exception_on_error=False)
assert_is_not_none(q.messages["Info"])
assert_equal(
q.messages["Info"],
("Regular expression and like patterns are not implemented for transactor names yet.",
None))
assert q.messages["Info"] is not None
assert q.messages["Info"][1]["@description"] == "Regular expression and like patterns are not implemented for transactor names yet."
def test_ticket_233():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment