@@ -84,10 +84,11 @@ def test_search_with_original_response(client: Client):
84
84
85
85
86
86
def test_collection (client : Client ):
87
+
87
88
docs = client .documents .search (
88
89
categories = ["content" , "collections" ], collections = ["search-test" ]
89
90
)
90
- assert len (docs ) == 2
91
+ assert len (docs ) == 4
91
92
92
93
doc1 = next (doc for doc in docs if doc .uri == "/doc1.json" )
93
94
assert doc1 .content is not None
@@ -101,6 +102,18 @@ def test_collection(client: Client):
101
102
assert "test-data" in doc1 .collections
102
103
assert "search-test" in doc1 .collections
103
104
105
+ doc3 = next (doc for doc in docs if doc .uri == "/doc2;copy.xml" )
106
+ assert doc3 .content is not None
107
+ assert len (doc3 .collections ) == 2
108
+ assert "test-data" in doc3 .collections
109
+ assert "search-test" in doc3 .collections
110
+
111
+ doc4 = next (doc for doc in docs if doc .uri == "/doc2=copy.xml" )
112
+ assert doc4 .content is not None
113
+ assert len (doc4 .collections ) == 2
114
+ assert "test-data" in doc4 .collections
115
+ assert "search-test" in doc4 .collections
116
+
104
117
105
118
def test_not_rest_user (not_rest_user_client : Client ):
106
119
response : Response = not_rest_user_client .documents .search (q = "hello" )
@@ -109,3 +122,27 @@ def test_not_rest_user(not_rest_user_client: Client):
109
122
), """The user does not have the rest-reader privilege, so MarkLogic is expected
110
123
to return a 403. And the documents.search method is then expected to return the
111
124
Response so that the user has access to everything in it."""
125
+
126
+
127
+ def test_version_id (client : Client ):
128
+ equalSignEtag = (
129
+ client .get ("v1/documents?uri=/doc2=copy.xml" )
130
+ .headers ["ETag" ]
131
+ .replace ('"' , "" )
132
+ )
133
+
134
+ semicolonEtag = (
135
+ client .get ("v1/documents?uri=/doc2;copy.xml" )
136
+ .headers ["ETag" ]
137
+ .replace ('"' , "" )
138
+ )
139
+
140
+ docs = client .documents .search (
141
+ categories = ["content" , "collections" ], collections = ["search-test" ]
142
+ )
143
+
144
+ doc1 = next (doc for doc in docs if doc .uri == "/doc2=copy.xml" )
145
+ assert doc1 .version_id == equalSignEtag
146
+
147
+ doc2 = next (doc for doc in docs if doc .uri == "/doc2;copy.xml" )
148
+ assert doc2 .version_id == semicolonEtag
0 commit comments