diff PerfsDb/Tests/UploadFile.py @ 156:f1a75985caa8

first Db test framework - work in progress
author am@osimis.io
date Thu, 16 Aug 2018 17:13:32 +0200
parents
children df1f9946571c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PerfsDb/Tests/UploadFile.py	Thu Aug 16 17:13:32 2018 +0200
@@ -0,0 +1,21 @@
+from Test import Test
+
+class TestUploadFile(Test):
+
+    def __init__(self, name:str = "UploadFile", filePath:str = "../Database/DummyCT.dcm"):
+        super().__init__(name)
+        self._instanceId = None
+        self._filePath = filePath
+        self._dicomFileContent = None
+
+    def prepare(self):
+        # get the instance Id and dicom file content
+        if self._instanceId is None:
+            self._instanceId = self._orthanc.uploadDicomFile(self._filePath)
+            self._dicomFileContent = self._orthanc.instances.getDicom(self._instanceId)
+
+        # make sure the file is not in Orthanc before the upload
+        self._orthanc.instances.delete(self._instanceId)
+
+    def test(self):
+        self._orthanc.uploadDicom(self._dicomFileContent)
\ No newline at end of file