annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
156
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
1 from Test import Test
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
2
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
3 class TestUploadFile(Test):
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
4
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
5 def __init__(self, name:str = "UploadFile", filePath:str = "../Database/DummyCT.dcm"):
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
6 super().__init__(name)
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
7 self._instanceId = None
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
8 self._filePath = filePath
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
9 self._dicomFileContent = None
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
10
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
11 def prepare(self):
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
12 # get the instance Id and dicom file content
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
13 if self._instanceId is None:
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
14 self._instanceId = self._orthanc.uploadDicomFile(self._filePath)
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
15 self._dicomFileContent = self._orthanc.instances.getDicom(self._instanceId)
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
16
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
17 # make sure the file is not in Orthanc before the upload
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
18 self._orthanc.instances.delete(self._instanceId)
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
19
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
20 def test(self):
f1a75985caa8 first Db test framework - work in progress
am@osimis.io
parents:
diff changeset
21 self._orthanc.uploadDicom(self._dicomFileContent)