Skip to content

Commit 05e0e0b

Browse files
committed
Refactoring tests
1 parent bbcb533 commit 05e0e0b

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

tests/integration_test_solid_api.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,26 +147,23 @@ def test_file():
147147
api.delete(url)
148148
assert not api.item_exists(url)
149149

150-
# patch - create ttl file
150+
151+
def test_patch_file():
152+
url = POD_ENDPOINT + 'test.md.' + gen_random_str()
153+
api = SolidAPI(None)
154+
155+
# create ttl file
151156
patchedUrl = url + '.ttl'
152157
body = "<> <http://purl.org/dc/terms/title> \"This is a test file\" .\n<> <http://www.w3.org/2000/10/swap/pim/contact#fullName> \"Eric Miller\" ."
153158
f = io.BytesIO(body.encode('UTF-8'))
154159
api.create_file(patchedUrl, f, 'text/turtle', WriteOptions())
155160

156-
# retrieve ttl file
157-
resp = api.get(patchedUrl)
158-
assert resp.text == body
159-
160-
# patch - update ttl file
161+
# patch ttl file
161162
body = "DELETE DATA { <> <http://www.w3.org/2000/10/swap/pim/contact#fullName> \"Eric Miller\" };\nINSERT DATA { <> <http://www.w3.org/2000/10/swap/pim/contact#personalTitle> \"Dr.\" }"
162163
f = io.BytesIO(body.encode('UTF-8'))
163164
api.patch_file(patchedUrl, f, 'application/sparql-update')
164165

165-
# retrieve updated ttl file
166+
# retrieve patched ttl file
166167
resp = api.get(patchedUrl)
167168
lines = resp.text.split('\n')
168169
assert lines[4] == '<> dct:title "This is a test file"; contact:personalTitle "Dr.".'
169-
170-
171-
172-

0 commit comments

Comments
 (0)