Mercurial > hg > orthanc-tests
comparison Tests/Toolbox.py @ 693:4567c3947f8a
more requested tags tests
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Thu, 19 Sep 2024 11:20:17 +0200 |
parents | 5d7b6e43ab7d |
children | 8b255268d79b |
comparison
equal
deleted
inserted
replaced
692:377ad9690c7a | 693:4567c3947f8a |
---|---|
352 b = int(tmp[1]) | 352 b = int(tmp[1]) |
353 c = int(tmp[2]) | 353 c = int(tmp[2]) |
354 return (a > major or | 354 return (a > major or |
355 (a == major and b > minor) or | 355 (a == major and b > minor) or |
356 (a == major and b == minor and c >= revision)) | 356 (a == major and b == minor and c >= revision)) |
357 | |
358 | |
359 def HasExtendedFind(orthanc): | |
360 v = DoGet(orthanc, '/system') | |
361 | |
362 if 'Capabilities' in v and 'HasExtendedFind' in v['Capabilities']: | |
363 return v['Capabilities']['HasExtendedFind'] | |
364 return False | |
365 | |
366 | |
367 def HasExtendedChanges(orthanc): | |
368 v = DoGet(orthanc, '/system') | |
369 | |
370 if 'Capabilities' in v and 'HasExtendedChanges' in v['Capabilities']: | |
371 return v['Capabilities']['HasExtendedChanges'] | |
372 return False | |
373 | |
374 | |
375 def GetStorageAccessesCount(orthanc): | |
376 mm = DoGetRaw(orthanc, "/tools/metrics-prometheus")[1] | |
377 | |
378 if (sys.version_info >= (3, 0)): | |
379 try: | |
380 mm = mm.decode() | |
381 except: | |
382 pass | |
383 | |
384 mm = [x.split(" ") for x in mm.split("\n")] | |
385 | |
386 count = 0 | |
387 for m in mm: | |
388 if m[0] == 'orthanc_storage_cache_hit_count': | |
389 count += int(m[1]) | |
390 if m[0] == 'orthanc_storage_cache_miss_count': | |
391 count += int(m[1]) | |
392 | |
393 # print("storage access count = %s" % count) | |
394 return count | |
395 | |
357 | 396 |
358 def IsPluginVersionAbove(orthanc, plugin, major, minor, revision): | 397 def IsPluginVersionAbove(orthanc, plugin, major, minor, revision): |
359 v = DoGet(orthanc, '/plugins/%s' % plugin)['Version'] | 398 v = DoGet(orthanc, '/plugins/%s' % plugin)['Version'] |
360 | 399 |
361 if v == 'mainline': | 400 if v == 'mainline': |