Mercurial > hg > orthanc-tests
comparison Plugins/DicomWeb/Run.py @ 33:eb6d219af210
test stow
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 02 Aug 2015 14:01:32 +0200 |
parents | 682c4e2a1162 |
children | 97acfdf0dbce |
comparison
equal
deleted
inserted
replaced
32:682c4e2a1162 | 33:eb6d219af210 |
---|---|
17 # You should have received a copy of the GNU General Public License | 17 # You should have received a copy of the GNU General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 | 20 |
21 import os | 21 import os |
22 import pprint | |
22 import sys | 23 import sys |
23 import argparse | 24 import argparse |
24 import unittest | 25 import unittest |
26 from DicomWeb import * | |
25 | 27 |
26 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'Tests')) | 28 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'Tests')) |
27 from Toolbox import * | 29 from Toolbox import * |
28 | 30 |
29 | 31 |
47 default = 'orthanctest', | 49 default = 'orthanctest', |
48 help = 'Password to the REST API') | 50 help = 'Password to the REST API') |
49 parser.add_argument('--wado', | 51 parser.add_argument('--wado', |
50 default = '/wado', | 52 default = '/wado', |
51 help = 'Path to the WADO API') | 53 help = 'Path to the WADO API') |
52 parser.add_argument('--dicom-web', | 54 parser.add_argument('--dicomweb', |
53 default = '/dicom-web/', | 55 default = '/dicom-web/', |
54 help = 'Path to the DICOMweb API') | 56 help = 'Path to the DICOMweb API') |
55 parser.add_argument('--force', help = 'Do not warn the user', | 57 parser.add_argument('--force', help = 'Do not warn the user', |
56 action = 'store_true') | 58 action = 'store_true') |
57 parser.add_argument('options', metavar = 'N', nargs = '*', | 59 parser.add_argument('options', metavar = 'N', nargs = '*', |
138 self.assertEqual('PNG', im.format) | 140 self.assertEqual('PNG', im.format) |
139 self.assertEqual('L', im.mode) | 141 self.assertEqual('L', im.mode) |
140 self.assertEqual(512, im.size[0]) | 142 self.assertEqual(512, im.size[0]) |
141 self.assertEqual(358, im.size[1]) | 143 self.assertEqual(358, im.size[1]) |
142 | 144 |
145 def test_stow(self): | |
146 self.assertEqual(0, len(DoGet(ORTHANC, '/instances'))) | |
147 SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Phenix/IM-0001-0001.dcm')) | |
148 self.assertEqual(1, len(DoGet(ORTHANC, '/instances'))) | |
149 a = SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Phenix/IM-0001-0001.dcm')) | |
150 self.assertEqual(1, len(DoGet(ORTHANC, '/instances'))) | |
151 | |
152 self.assertEqual(0, len(a['00081198']['Value'])) # No error | |
153 self.assertEqual(1, len(a['00081199']['Value'])) # 1 success | |
154 | |
155 self.assertTrue(a['00081190']['Value'][0].endswith('studies/2.16.840.1.113669.632.20.1211.10000098591')) | |
156 self.assertTrue(a['00081199']['Value'][0]['00081190']['Value'][0]. | |
157 endswith('series/1.2.840.113704.1.111.5692.1127828999.2/instances/1.2.840.113704.7.1.1.6632.1127829031.2')) | |
158 | |
159 b = GetMultipart(a['00081190']['Value'][0]) | |
160 self.assertEqual(1, len(b)) | |
161 self.assertEqual(368852, len(b[0])) | |
162 | |
143 | 163 |
144 | 164 |
145 try: | 165 try: |
146 print('\nStarting the tests...') | 166 print('\nStarting the tests...') |
147 unittest.main(argv = [ sys.argv[0] ] + args.options) | 167 unittest.main(argv = [ sys.argv[0] ] + args.options) |