def test_merge_links(self): d = Document({ "id": "1", "title": "document", "link": [ { "href": "https://peerj.com/articles/53/", "type": "text/html" }, { "href": "https://peerj.com/articles/53.pdf", "type": "application/pdf" } ], }) d.save() d = Document.fetch(1) assert d assert_equal(len(d['link']), 2) d.merge_links([ { "href": "https://peerj.com/articles/53/", "type": "text/html" }, { "href": "http://peerj.com/articles/53.doc", "type": "application/vnd.ms-word.document" } ]) d.save() assert_equal(len(d['link']), 3) d = Document.fetch(1) assert d assert_equal(len(d['link']), 3) doc = Document.get_by_uri("https://peerj.com/articles/53/") assert doc assert_equal(len(doc['link']), 3)
def test_merge_links(self): d = Document({ "id": "1", "title": "document", "link": [peerj["html"], peerj["pdf"]] }) d.save() d = Document.fetch(1) assert d assert_equal(len(d['link']), 2) d.merge_links([peerj["html"], peerj["doc"]]) d.save() assert_equal(len(d['link']), 3) d = Document.fetch(1) assert d assert_equal(len(d['link']), 3) doc = Document.get_by_uri("https://peerj.com/articles/53/") assert doc assert_equal(len(doc['link']), 3)
def test_merge_links(self): d = Document({ "id": "1", "title": "document", "link": [{ "href": "https://peerj.com/articles/53/", "type": "text/html" }, { "href": "https://peerj.com/articles/53.pdf", "type": "application/pdf" }], }) d.save() d = Document.fetch(1) assert d assert_equal(len(d['link']), 2) d.merge_links([{ "href": "https://peerj.com/articles/53/", "type": "text/html" }, { "href": "http://peerj.com/articles/53.doc", "type": "application/vnd.ms-word.document" }]) d.save() assert_equal(len(d['link']), 3) d = Document.fetch(1) assert d assert_equal(len(d['link']), 3) doc = Document.get_by_uri("https://peerj.com/articles/53/") assert doc assert_equal(len(doc['link']), 3)