def test_20_Multipart_POST_to_se_iri(self): conn = Connection("http://localhost:%s/sd-uri" % PORT_NUMBER, user_name="sword", user_pass="******", download_service_document=True) e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", dcterms_title="foo bar") deposit_receipt = conn.create( payload="Multipart_POST_then_update_on_EM_IRI", metadata_entry=e, mimetype="text/plain", filename="readme.txt", packaging='http://purl.org/net/sword/package/Binary', col_iri=conn.sd.workspaces[0][1][0].href, in_progress=True) assert deposit_receipt.se_iri != None e.add_fields(dcterms_identifier="doi://multipart_update_to_SE_IRI") dr = conn.append( se_iri=deposit_receipt.se_iri, payload= "Multipart_POST_then_appending_file_on_SE_IRI -- updated resource", mimetype="text/plain", filename="readthisextrafile.txt", packaging="http://purl.org/net/sword/package/Binary", metadata_entry=e) print dr.code assert dr.code == 201
def test_13_Metadata_POST_to_sss_altering_entry(self): conn = Connection("http://localhost:%s/sd-uri" % PORT_NUMBER, user_name="sword", user_pass="******", download_service_document=True) e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", dcterms_title="foo bar") e.add_fields(dcterms_identifier="doi://somerubbish", dcterms_foo="blah blah") resp = conn.create(metadata_entry = e, workspace='Main Site', collection=conn.sd.workspaces[0][1][0].title, in_progress=False) assert resp != None
def test_06_init_add_fields(self): e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", author={'name':'Ben', 'email':'*****@*****.**'}) e.add_fields(dcterms_issued="2009", updated="2010", dcterms_description="A verbose and new description") assert e.entry.find(NS['atom'] % 'updated') != None assert e.entry.find(NS['atom'] % 'updated').text == "2010" assert e.entry.find(NS['dcterms'] % 'issued') != None assert e.entry.find(NS['dcterms'] % 'issued').text == "2009" assert e.entry.find(NS['dcterms'] % 'description') != None assert e.entry.find(NS['dcterms'] % 'description').text == "A verbose and new description"
def test_08_init_add_new_ns_fields(self): e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", author={'name':'Ben', 'email':'*****@*****.**'}) e.register_namespace("mylocal", "info:localnamespace") e.add_fields(mylocal_foobar="2009", updated="2010", mylocal_description="A verbose and new description") assert e.entry.find(NS['atom'] % 'updated') != None assert e.entry.find(NS['atom'] % 'updated').text == "2010" assert e.entry.find(NS['mylocal'] % 'foobar') != None assert e.entry.find(NS['mylocal'] % 'foobar').text == "2009" assert e.entry.find(NS['mylocal'] % 'description') != None assert e.entry.find(NS['mylocal'] % 'description').text == "A verbose and new description"
def test_13_Metadata_POST_to_sss_altering_entry(self): conn = Connection("http://localhost:%s/sd-uri" % PORT_NUMBER, user_name="sword", user_pass="******", download_service_document=True) e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", dcterms_title="foo bar") e.add_fields(dcterms_identifier="doi://somerubbish", dcterms_foo="blah blah") resp = conn.create(metadata_entry=e, workspace='Main Site', collection=conn.sd.workspaces[0][1][0].title, in_progress=False) assert resp != None
def test_11_Multipart_POST_then_update_metadata_on_Edit_IRI(self): conn = Connection("http://localhost:%s/sd-uri" % PORT_NUMBER, user_name="sword", user_pass="******", download_service_document=True) e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", dcterms_title="foo bar") deposit_receipt = conn.create(payload = "Multipart_POST_then_update_on_EM_IRI", metadata_entry = e, mimetype = "text/plain", filename = "readme.txt", packaging = 'http://purl.org/net/sword/package/Binary', col_iri = conn.sd.workspaces[0][1][0].href, in_progress=True) assert deposit_receipt.code == 201 # new resource e.add_fields(dcterms_newfield = "blah de blah") dr = conn.update_metadata_for_resource(edit_iri = deposit_receipt.edit, metadata_entry = e) assert (dr.code == 200 or dr.code == 204)
def test_18_Metadata_POST_to_se_iri(self): conn = Connection("http://localhost:%s/sd-uri" % PORT_NUMBER, user_name="sword", user_pass="******", download_service_document=True) e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", dcterms_title="foo bar") deposit_receipt = conn.create(payload = "Multipart_POST_then_update_on_EM_IRI", metadata_entry = e, mimetype = "text/plain", filename = "readme.txt", packaging = 'http://purl.org/net/sword/package/Binary', col_iri = conn.sd.workspaces[0][1][0].href, in_progress=True) assert deposit_receipt.se_iri != None e.add_fields(dcterms_identifier="doi://somerubbish", dcterms_foo="blah blah") dr = conn.append(se_iri = deposit_receipt.se_iri, metadata_entry = e, in_progress=False) assert dr.code == 200
def test_11_Multipart_POST_then_update_metadata_on_Edit_IRI(self): conn = Connection("http://localhost:%s/sd-uri" % PORT_NUMBER, user_name="sword", user_pass="******", download_service_document=True) e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", dcterms_title="foo bar") deposit_receipt = conn.create( payload="Multipart_POST_then_update_on_EM_IRI", metadata_entry=e, mimetype="text/plain", filename="readme.txt", packaging='http://purl.org/net/sword/package/Binary', col_iri=conn.sd.workspaces[0][1][0].href, in_progress=True) assert deposit_receipt.code == 201 # new resource e.add_fields(dcterms_newfield="blah de blah") dr = conn.update_metadata_for_resource(edit_iri=deposit_receipt.edit, metadata_entry=e) assert (dr.code == 200 or dr.code == 204)