Skip to content

Commit f9ad0eb

Browse files
committed
Store entity URL path without host - cf. issue #4 and issue #32. All tests pass.
1 parent 8735d4d commit f9ad0eb

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

documents/TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ NOTE: this document is used for short-term working notes; longer-term planning i
6666
- [x] annalist/views/genericedit.py (missing collection, type, view description, entity)
6767
- [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))
6868
- [x] Add field to view: check property URI is unique
69-
- [ ] 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))
69+
- [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))
7070
- [ ] Investigate use of path-only references for copntinuation URIs
7171
[ ] would need to resolve when generating Location: header field ...
7272
[ ] ... or does Django handle that anyway?)

src/annalist_root/annalist/tests/test_entitydefaultedit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,12 @@ def test_get_new(self):
216216
self.assertEqual(r.status_code, 200)
217217
self.assertEqual(r.reason_phrase, "OK")
218218
# Test context
219+
view_url = entity_url(coll_id="testcoll", type_id="testtype", entity_id="00000001")
219220
self.assertEqual(r.context['coll_id'], "testcoll")
220221
self.assertEqual(r.context['type_id'], "testtype")
221222
self.assertEqual(r.context['entity_id'], "00000001")
222223
self.assertEqual(r.context['orig_id'], "00000001")
223-
self.assertEqual(r.context['entity_url'], TestHostUri + entity_url(entity_id="00000001"))
224+
self.assertEqual(r.context['entity_url'], view_url)
224225
self.assertEqual(r.context['action'], "new")
225226
self.assertEqual(r.context['continuation_url'], "/xyzzy/")
226227
# Fields
@@ -307,11 +308,12 @@ def test_get_edit(self):
307308
self.assertEqual(r.reason_phrase, "OK")
308309
self.assertContains(r, "<title>Collection testcoll</title>")
309310
# Test context
311+
view_url = entity_url(coll_id="testcoll", type_id="testtype", entity_id="entity1")
310312
self.assertEqual(r.context['coll_id'], "testcoll")
311313
self.assertEqual(r.context['type_id'], "testtype")
312314
self.assertEqual(r.context['entity_id'], "entity1")
313315
self.assertEqual(r.context['orig_id'], "entity1")
314-
self.assertEqual(r.context['entity_url'], TestHostUri + entity_url("testcoll", "testtype", "entity1"))
316+
self.assertEqual(r.context['entity_url'], view_url)
315317
self.assertEqual(r.context['action'], "edit")
316318
self.assertEqual(r.context['continuation_url'], "/xyzzy/")
317319
# Fields

src/annalist_root/annalist/tests/test_entityenum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def recordenum_create_values(
7878
})
7979

8080
def recordenum_values(enum_id, coll_id="testcoll", type_id="testtype", update="Enum", hosturi=TestHostUri):
81-
enumurl = hosturi + recordenum_view_url(enum_id, coll_id=coll_id, type_id=type_id)
81+
enumurl = recordenum_view_url(enum_id, coll_id=coll_id, type_id=type_id)
8282
d = recordenum_create_values(
8383
enum_id, coll_id=coll_id, type_id=type_id, update=update, hosturi=hosturi
8484
).copy() #@@ copy needed here?

0 commit comments

Comments
 (0)