Skip to content

Commit

Permalink
Store entity URL path without host - cf. issue #4 and issue #32. All …
Browse files Browse the repository at this point in the history
…tests pass.
  • Loading branch information
gklyne committed Oct 16, 2014
1 parent 8735d4d commit f9ad0eb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion documents/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ NOTE: this document is used for short-term working notes; longer-term planning i
- [x] annalist/views/genericedit.py (missing collection, type, view description, entity)
- [x] Scan code for all uses of 'annal:xxx' CURIES, and replace with ANNAL.CURIE.xxx references. (See issue [#4](https://github.com/gklyne/annalist/issues/4))
- [x] Add field to view: check property URI is unique
- [ ] Don't store host name in entity URL fields (this is just a start - see issues [#4](https://github.com/gklyne/annalist/issues/4), [#32](https://github.com/gklyne/annalist/issues/32))
- [x] Don't store host name in entity URL fields (this is just a start - see issues [#4](https://github.com/gklyne/annalist/issues/4), [#32](https://github.com/gklyne/annalist/issues/32))
- [ ] Investigate use of path-only references for copntinuation URIs
[ ] would need to resolve when generating Location: header field ...
[ ] ... or does Django handle that anyway?)
Expand Down
6 changes: 4 additions & 2 deletions src/annalist_root/annalist/tests/test_entitydefaultedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,12 @@ def test_get_new(self):
self.assertEqual(r.status_code, 200)
self.assertEqual(r.reason_phrase, "OK")
# Test context
view_url = entity_url(coll_id="testcoll", type_id="testtype", entity_id="00000001")
self.assertEqual(r.context['coll_id'], "testcoll")
self.assertEqual(r.context['type_id'], "testtype")
self.assertEqual(r.context['entity_id'], "00000001")
self.assertEqual(r.context['orig_id'], "00000001")
self.assertEqual(r.context['entity_url'], TestHostUri + entity_url(entity_id="00000001"))
self.assertEqual(r.context['entity_url'], view_url)
self.assertEqual(r.context['action'], "new")
self.assertEqual(r.context['continuation_url'], "/xyzzy/")
# Fields
Expand Down Expand Up @@ -307,11 +308,12 @@ def test_get_edit(self):
self.assertEqual(r.reason_phrase, "OK")
self.assertContains(r, "<title>Collection testcoll</title>")
# Test context
view_url = entity_url(coll_id="testcoll", type_id="testtype", entity_id="entity1")
self.assertEqual(r.context['coll_id'], "testcoll")
self.assertEqual(r.context['type_id'], "testtype")
self.assertEqual(r.context['entity_id'], "entity1")
self.assertEqual(r.context['orig_id'], "entity1")
self.assertEqual(r.context['entity_url'], TestHostUri + entity_url("testcoll", "testtype", "entity1"))
self.assertEqual(r.context['entity_url'], view_url)
self.assertEqual(r.context['action'], "edit")
self.assertEqual(r.context['continuation_url'], "/xyzzy/")
# Fields
Expand Down
2 changes: 1 addition & 1 deletion src/annalist_root/annalist/tests/test_entityenum.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def recordenum_create_values(
})

def recordenum_values(enum_id, coll_id="testcoll", type_id="testtype", update="Enum", hosturi=TestHostUri):
enumurl = hosturi + recordenum_view_url(enum_id, coll_id=coll_id, type_id=type_id)
enumurl = recordenum_view_url(enum_id, coll_id=coll_id, type_id=type_id)
d = recordenum_create_values(
enum_id, coll_id=coll_id, type_id=type_id, update=update, hosturi=hosturi
).copy() #@@ copy needed here?
Expand Down

0 comments on commit f9ad0eb

Please sign in to comment.