Mercurial > hg > orthanc-tests
diff Tests/Toolbox.py @ 192:6ff9d035b26b Orthanc-1.5.1
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 15 Dec 2018 10:50:45 +0100 |
parents | 911070f790e3 |
children | af8e034f4262 |
line wrap: on
line diff
--- a/Tests/Toolbox.py Fri Dec 14 11:42:18 2018 +0100 +++ b/Tests/Toolbox.py Sat Dec 15 10:50:45 2018 +0100 @@ -214,6 +214,15 @@ else: return zipfile.ZipFile(StringIO(s), "r") +def PostArchive(orthanc, uri, body): + # http://stackoverflow.com/a/1313868/881731 + s = DoPost(orthanc, uri, body) + + if (sys.version_info >= (3, 0)): + return zipfile.ZipFile(BytesIO(s), "r") + else: + return zipfile.ZipFile(StringIO(s), "r") + def IsDefinedInLua(orthanc, name): s = DoPost(orthanc, '/tools/execute-script', 'print(type(%s))' % name, 'application/lua') return (s.strip() != 'nil')