Mercurial > hg > orthanc-tests
diff Tests/Toolbox.py @ 342:bf8369ea3ff1
more tests of webdav
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 15 Oct 2020 17:34:01 +0200 |
parents | 66a36befb208 |
children | 79ce0f7a9714 |
line wrap: on
line diff
--- a/Tests/Toolbox.py Wed Oct 14 19:55:26 2020 +0200 +++ b/Tests/Toolbox.py Thu Oct 15 17:34:01 2020 +0200 @@ -141,7 +141,7 @@ resp, content = http.request(orthanc['Url'] + uri, method, body = body, headers = headers) - if not (resp.status in [ 200, 302 ]): + if not (resp.status in [ 200, 201, 302 ]): raise Exception(resp.status, resp) else: return _DecodeJson(content) @@ -241,7 +241,7 @@ while True: if len(DoGet(orthanc, '/instances')) == 0: return - time.sleep(0.1) + time.sleep(0.01) def WaitJobDone(orthanc, job): while True: @@ -252,7 +252,7 @@ elif s == 'Failure': return False - time.sleep(0.1) + time.sleep(0.01) def MonitorJob(orthanc, func): # "func" is a lambda a = set(DoGet(orthanc, '/jobs')) @@ -479,7 +479,22 @@ raise Exception() if href == None or prop == None: raise Exception() - result[href] = prop + + info = {} + + for j in prop.childNodes: + if j.nodeType == minidom.Node.ELEMENT_NODE: + if j.nodeName == 'D:displayname': + info['displayname'] = j.firstChild.nodeValue if j.firstChild != None else '' + elif j.nodeName == 'D:creationdate': + info['creationdate'] = j.firstChild.nodeValue + elif j.nodeName == 'D:getlastmodified': + info['lastmodified'] = j.firstChild.nodeValue + elif j.nodeName == 'D:resourcetype': + k = j.getElementsByTagName('D:collection') + info['folder'] = (len(k) == 1) + + result[href] = info elif i.nodeType != minidom.Node.TEXT_NODE: raise Exception()