Skip to content

Commit c1a3faf

Browse files
committed
refactor: remove extra func in test_solid_api and add delete test
1 parent 3765c49 commit c1a3faf

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/solid/solid_api.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,8 @@ def put_file(self, url, content: RequestContent, content_type, options: WriteOpt
189189
return self.put(url, request_options)
190190

191191
def patch_file(self, url, patch_content, patch_content_type) -> Response:
192-
# raise Exception('Not implemented')
193192
if url[-1] == '/':
194193
raise Exception("Cannot use patchFile to create a folder : {}".format(url))
195-
# if options.merge == MERGE.KEEP_TARGET and self.item_exists(url):
196-
# raise Exception(f'File already exists: {url}')
197194

198195
request_options = {
199196
'headers': {

tests/test_solid_api.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
def gen_random_str() -> str:
1414
return uuid.uuid4().hex
1515

16-
def parse_turtle(turtle: str) -> str:
17-
lines = turtle.split('\n')
18-
for line in lines:
19-
if line.startswith('<> dct'):
20-
return line
2116

2217
POD_ENDPOINT = os.getenv('SOLID_ENDPOINT')
2318
IDP = os.getenv('SOLID_IDP')
@@ -150,6 +145,7 @@ def test_file():
150145

151146
# delete
152147
api.delete(url)
148+
assert not api.item_exists(url)
153149

154150
# patch - create ttl file
155151
patchedUrl = url + '.ttl'
@@ -168,8 +164,8 @@ def test_file():
168164

169165
# retrieve updated ttl file
170166
resp = api.get(patchedUrl)
171-
patchedBody = '<> dct:title "This is a test file"; contact:personalTitle "Dr.".'
172-
assert parse_turtle(resp.text) == patchedBody
167+
lines = resp.text.split('\n')
168+
assert lines[4] == '<> dct:title "This is a test file"; contact:personalTitle "Dr.".'
173169

174170

175171

0 commit comments

Comments
 (0)