diff 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
line wrap: on
line diff
--- a/Tests/Toolbox.py	Thu Sep 19 09:57:32 2024 +0200
+++ b/Tests/Toolbox.py	Thu Sep 19 11:20:17 2024 +0200
@@ -355,6 +355,45 @@
                 (a == major and b > minor) or
                 (a == major and b == minor and c >= revision))
 
+
+def HasExtendedFind(orthanc):
+    v = DoGet(orthanc, '/system')
+
+    if 'Capabilities' in v and 'HasExtendedFind' in v['Capabilities']:
+        return v['Capabilities']['HasExtendedFind']
+    return False
+
+
+def HasExtendedChanges(orthanc):
+    v = DoGet(orthanc, '/system')
+
+    if 'Capabilities' in v and 'HasExtendedChanges' in v['Capabilities']:
+        return v['Capabilities']['HasExtendedChanges']
+    return False
+
+
+def GetStorageAccessesCount(orthanc):
+    mm = DoGetRaw(orthanc, "/tools/metrics-prometheus")[1]
+
+    if (sys.version_info >= (3, 0)):
+        try:
+            mm = mm.decode()
+        except:
+            pass
+
+    mm = [x.split(" ") for x in mm.split("\n")]
+
+    count = 0
+    for m in mm:
+        if m[0] == 'orthanc_storage_cache_hit_count':
+            count += int(m[1])
+        if m[0] == 'orthanc_storage_cache_miss_count':
+            count += int(m[1])
+
+    # print("storage access count = %s" % count)
+    return count
+
+
 def IsPluginVersionAbove(orthanc, plugin, major, minor, revision):
     v = DoGet(orthanc, '/plugins/%s' % plugin)['Version']