diff -r 59311c28454f -r 4d17de9ee64e web/ldt/ldt_utils/tests.py
--- a/web/ldt/ldt_utils/tests.py Mon Nov 15 18:56:22 2010 +0100
+++ b/web/ldt/ldt_utils/tests.py Tue Nov 16 11:57:22 2010 +0100
@@ -15,6 +15,7 @@
from django.contrib.auth.models import *
from django.conf import settings
from django.test.client import Client
+from ldt.ldt_utils import VERSION_STR
@@ -33,7 +34,7 @@
annot.delete()
def test_create_annotation(self):
- response = self.c.post('/ldt/create/', {'content':self.content})
+ response = self.c.post('/api/'+ VERSION_STR +'/text/create/', {'content':self.content})
self.annot1 = lxml.etree.fromstring(response.content)
self.assertEqual(self.annot1.xpath("/iri/text-annotation/id/text()")[0],"f2c1d1fa-629d-4520-a3d2-955b4f2582c0")
self.assertEqual(self.annot1.xpath("/iri/text-annotation/content")[0].tag,"content")
@@ -45,7 +46,7 @@
# def test_error_create(self):
# content = base64.urlsafe_b64encode('d2c1d1fa-629d-4520-a3d2-955b4f2582c0http://www.leezam.com/pub/epub/123456!/OPS/chapter2.xhtml#pos=56,168tag1tag2#AAAAAAoaubert79cd0532-1dda-4130-b351-6a181130a7c92010-09-06 12:33:53.417550oaubert79cd0532-1dda-4130-b351-6a181130a7c92010-09-06 12:33:53.420459')
-# response = self.c.post('/ldt/create/', {'content':content})
+# response = self.c.post('/api/'+ VERSION_STR +'/text/create/', {'content':content})
# #annot2 = create_annotation(content)
# self.assertEqual(response.status_code, '409')
@@ -62,7 +63,7 @@
annot.delete()
def test_get_annotation(self):
- response = self.c.get('/ldt/get/', {'id':'d2c1d1fa-629d-4520-a3d2-955b4f2582c0'})
+ response = self.c.get('/api/'+ VERSION_STR +'/text/get/', {'id':'d2c1d1fa-629d-4520-a3d2-955b4f2582c0'})
self.annot1 = lxml.etree.fromstring(response.content)
#self.annot1 = get_annotation("d2c1d1fa-629d-4520-a3d2-955b4f2582c0")
self.assertEqual(self.annot1.xpath("/iri/text-annotation/id/text()")[0],self.annotation.id)
@@ -71,8 +72,8 @@
#self.assertEqual(self.annot1.xpath("/iri/text-annotation/meta/created/text()"), self.annotation.creation_date)
# def test_error_get(self):
-# response = self.c.get('/ldt/get/', {'id':'2'})
-# #response = self.c.get('/ldt/get/', {'id':'2'})
+# response = self.c.get('/api/'+ VERSION_STR +'/text/get/', {'id':'2'})
+# #response = self.c.get('/api/'+ VERSION_STR +'/text/get/', {'id':'2'})
# #annot3 = get_annotation('d2c1d1fa-629d-4520-a3d2-955b4f2582c0')
# #resp = response.status_code
# self.assertEqual(response.status_code,'404')
@@ -96,7 +97,7 @@
user = 'wakimd'
uri = "http://www.leezam.com/pub/epub/123456!/OPS/chapter2.xhtml#pos=56,168"
limit= 1
- response = self.c.get('/ldt/filter/', {'uri':uri,'creator':user,'limit':limit})
+ response = self.c.get('/api/'+ VERSION_STR +'/text/filter/', {'uri':uri,'creator':user,'limit':limit})
doc = lxml.etree.fromstring(response.content)
#doc = filter_annotation(uri,None,limit,user)
cpt = 0
@@ -111,7 +112,7 @@
def test_filter_annotation_uri(self):
uri = "http://www.leezam.com/pub/epub/123456!/OPS/chapter2.xhtml#pos=56,168"
- response = self.c.get('/ldt/filter/', {'uri':uri})
+ response = self.c.get('/api/'+ VERSION_STR +'/text/filter/', {'uri':uri})
doc = lxml.etree.fromstring(response.content)
#doc = filter_annotation(uri,None,limit,None)
for elem in doc.xpath("/iri/text-annotation/uri/text()"):
@@ -121,7 +122,7 @@
uri = "http://www.leezam.com/pub/epub/123456!/OPS/chapter2.xhtml#pos=56,168"
filter = 'lors'
limit = None
- response = self.c.get('/ldt/filter/', {'uri':uri,'filter':'lors'})
+ response = self.c.get('/api/'+ VERSION_STR +'/text/filter/', {'uri':uri,'filter':'lors'})
doc = lxml.etree.fromstring(response.content)
#doc = filter_annotation(uri,filter,limit,user)
for elem in doc.xpath("/iri/text-annotation/content/text/text()"):
@@ -144,7 +145,7 @@
annot.delete()
def test_delete_annotation(self):
- response = self.c.post('/ldt/delete/', {'id':'d2c1d1fa-629d-4520-a3d2-955b4f2582c0'})
+ response = self.c.post('/api/'+ VERSION_STR +'/text/delete/', {'id':'d2c1d1fa-629d-4520-a3d2-955b4f2582c0'})
#response2 = self.c.get('/ldt/get/', {'id':'d2c1d1fa-629d-4520-a3d2-955b4f2582c0'})
doc = lxml.etree.fromstring(response.content)
#doc=delete_annotation("d2c1d1fa-629d-4520-a3d2-955b4f2582c0")
@@ -155,7 +156,7 @@
#self.assertEqual(response2.status_code, '404')
# def test_error_delete(self):
-# response = self.c.post('/ldt/delete/', {'id':'1'})
+# response = self.c.post('/api/'+ VERSION_STR +'/text/ldt/delete/', {'id':'1'})
# #annot4 = delete_annotation('f2c1d1fa-629d-4520-a3d2-955b4f2582c0')
# self.assertEqual(response.status_code,'404')
@@ -173,7 +174,7 @@
def test_update_annotation(self):
content = base64.urlsafe_b64encode('tag1tag2newtag3#DDDDDDoaubert80cd0532-1dda-4130-b351-6a181130a7c92010-11-06 12:33:53.420459')
- response = self.c.post('/ldt/update/', {'content':content,'id':'d2c1d1fa-629d-4520-a3d2-955b4f2582c0'})
+ response = self.c.post('/api/'+ VERSION_STR +'/text/update/', {'content':content,'id':'d2c1d1fa-629d-4520-a3d2-955b4f2582c0'})
doc = lxml.etree.fromstring(response.content)
#doc = update_annotation(content,'d2c1d1fa-629d-4520-a3d2-955b4f2582c0')
self.assertEqual(doc.xpath("/iri/text-annotation/id/text()")[0],"d2c1d1fa-629d-4520-a3d2-955b4f2582c0")
@@ -182,7 +183,7 @@
# def test_error_update(self):
# content = base64.urlsafe_b64encode('d2c1d1fa-629d-4520-a3d2-955b4f2582c0http://www.leezam.com/pub/epub/123456!/OPS/chapter2.xhtml#pos=56,168tag1tag2#AAAAAAoaubert79cd0532-1dda-4130-b351-6a181130a7c92010-09-06 12:33:53.417550oaubert79cd0532-1dda-4130-b351-6a181130a7c92010-09-06 12:33:53.420459')
-# response = self.c.post('/update/', {'content':content,'id':'1'})
+# response = self.c.post('/api/'+ VERSION_STR +'/text/update/', {'content':content,'id':'1'})
# #annot5=update_annotation()
# self.assertEqual(response.status_code,'404')
#