File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change 1- from marklogic .documents import DefaultMetadata , Document
1+ import json
2+ from marklogic .documents import Document
3+
4+
5+ def test_update_dsl_fromDocDescriptors (client ):
6+ doc_uri = "/doc1.json"
7+ doc_contents = {"hello" : "doc1" }
8+ doc_permissions = [
9+ {"capability" : "read" , "roleName" : "python-tester" },
10+ {"capability" : "update" , "roleName" : "python-tester" },
11+ ]
12+ update_query_fromDocDescriptors = f"""
13+ const docDescriptors = [
14+ {{
15+ uri:"{ doc_uri } ",
16+ doc:'{ json .dumps (doc_contents )} ',
17+ permissions: { json .dumps (doc_permissions )}
18+ }}
19+ ];
20+ op.fromDocDescriptors(docDescriptors).write()
21+ """
22+ response = client .rows .update (update_query_fromDocDescriptors , return_response = True )
23+ assert 200 == response .status_code
24+
25+ docs = client .documents .read ([doc_uri ])
26+ doc1 = next (doc for doc in docs if doc .uri == doc_uri )
27+ assert "application/json" == doc1 .content_type
28+ assert doc1 .version_id is not None
29+ assert doc_contents == doc1 .content
230
331
432def test_update_dsl_remove (admin_client ):
You can’t perform that action at this time.
0 commit comments