Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[all][m]: begin major upgrade to bring things up to date (all tests p…
…assing again). * Remove sqlobject in favour of sqlalchemy. * Remove use of formencode. * Have disabled all code using this -- basically the crude model browser (which should be replaced anyway with formalchemy+pylons) * Move to paste.fixture for testing of wsgi app part * demo is probably broken atm * Disable marginalia wsgiapp tests -- this should probably be removed in any case and replaced with something simpler
- Loading branch information
rgrp
committed
Jun 26, 2009
1 parent
5c98e06
commit 945f1dd
Showing
8 changed files
with
198 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
syntax: glob | ||
*.pyc | ||
*.egg-info/* | ||
sandbox/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import annotater.model | ||
annotater.model.set_default_connection() | ||
annotater.model.rebuilddb() | ||
import annotater.model as model | ||
model.set_default_connection() | ||
model.rebuilddb() | ||
|
||
class TestAnnotation: | ||
|
||
@classmethod | ||
def setup_class(self): | ||
self.url = 'http://xyz.com' | ||
self.anno = annotater.model.Annotation( | ||
self.url = u'http://xyz.com' | ||
anno = model.Annotation( | ||
url=self.url, | ||
range='31.0 32.5', | ||
note='It is a truth universally acknowledged', | ||
range=u'31.0 32.5', | ||
note=u'It is a truth universally acknowledged', | ||
) | ||
|
||
def teardown_class(cls): | ||
annotater.model.Annotation.delete(cls.anno.id) | ||
|
||
def test_1(self): | ||
out = annotater.model.Annotation.get(self.anno.id) | ||
model.Session.commit() | ||
self.anno_id = anno.id | ||
|
||
@classmethod | ||
def teardown_class(self): | ||
anno = model.Annotation.query.get(self.anno_id) | ||
model.Session.delete(anno) | ||
model.Session.commit() | ||
model.Session.remove() | ||
|
||
def test_0(self): | ||
out = model.Annotation.query.get(self.anno_id) | ||
assert out.url == self.url | ||
|
||
def test_list_annotations_html(self): | ||
out = annotater.model.Annotation.list_annotations_html() | ||
exp1 = "<Annotation 1 url=u'http://xyz.com'" | ||
assert exp1 in out | ||
|
||
def test_list_annotations_atom(self): | ||
out = annotater.model.Annotation.list_annotations_atom(self.url) | ||
def test_1_list_annotations_html(self): | ||
out = model.Annotation.list_annotations_html() | ||
exp1 = "Annotation %s http://xyz.com" % self.anno_id | ||
assert exp1 in out, out | ||
|
||
def test_2_list_annotations_atom(self): | ||
anno = model.Annotation.query.get(self.anno_id) | ||
out = model.Annotation.list_annotations_atom(self.url) | ||
exp1 = '<feed xmlns:ptr="http://www.geof.net/code/annotation/"' | ||
assert exp1 in out | ||
exp2 = '<title>%s</title>' % self.anno.note | ||
exp2 = '<title>%s</title>' % anno.note | ||
assert exp2 in out | ||
exp3 = '<link rel="related" type="text/html" title="quote_title_not_available_yet" href="%s"/>' % self.anno.url | ||
exp3 = '<link rel="related" type="text/html" title="quote_title_not_available_yet" href="%s"/>' % anno.url | ||
print out | ||
assert exp3 in out | ||
|
||
|
||
class TestAnnotationSchema: | ||
|
||
schema = annotater.model.AnnotationSchema() | ||
|
||
def test_default(self): | ||
out = self.schema.from_python(None) | ||
assert out == {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.