Mercurial > hg > orthanc-tests
comparison Plugins/DicomWeb/Run.py @ 246:e4e0e2ff91ae
test_bitbucket_issue_143
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 21 Jun 2019 18:25:44 +0200 |
parents | 49cf8ed97a28 |
children | 26c3a1ed935a |
comparison
equal
deleted
inserted
replaced
245:1ea269d46d82 | 246:e4e0e2ff91ae |
---|---|
265 def test_server_stow(self): | 265 def test_server_stow(self): |
266 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') | 266 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') |
267 | 267 |
268 self.assertRaises(Exception, lambda: | 268 self.assertRaises(Exception, lambda: |
269 DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | 269 DoPost(ORTHANC, '/dicom-web/servers/sample/stow', |
270 { 'Resources' : [ 'nope' ]})) # inexisting resource | 270 { 'Resources' : [ 'nope' ], |
271 | 271 'Synchronous' : True })) # inexisting resource |
272 self.assertEqual(0, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | 272 |
273 { 'Resources' : [ 'ca29faea-b6a0e17f-067743a1-8b778011-a48b2a17' ]}))) # patient | 273 l = 2 # For >= 0.7 |
274 | 274 #l = 0 # For <= 0.6 |
275 self.assertEqual(0, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | 275 |
276 { 'Resources' : [ '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918' ]}))) # study | 276 self.assertEqual(l, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', |
277 | 277 { 'Resources' : [ '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918' ], |
278 self.assertEqual(0, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | 278 'Synchronous' : True }))) # study |
279 { 'Resources' : [ '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285' ]}))) # series | 279 |
280 | 280 self.assertEqual(l, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', |
281 self.assertEqual(0, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | 281 { 'Resources' : [ '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285' ], |
282 { 'Resources' : [ 'c8df6478-d7794217-0f11c293-a41237c9-31d98357' ]}))) # instance | 282 'Synchronous' : True }))) # series |
283 | 283 |
284 self.assertEqual(0, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | 284 self.assertEqual(l, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', |
285 { 'Resources' : [ 'c8df6478-d7794217-0f11c293-a41237c9-31d98357' ], | |
286 'Synchronous' : True }))) # instance | |
287 | |
288 self.assertEqual(l, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | |
285 { 'Resources' : [ | 289 { 'Resources' : [ |
286 'ca29faea-b6a0e17f-067743a1-8b778011-a48b2a17', | 290 'ca29faea-b6a0e17f-067743a1-8b778011-a48b2a17', |
287 '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918', | 291 '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918', |
288 '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285', | 292 '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285', |
289 'c8df6478-d7794217-0f11c293-a41237c9-31d98357' ]}))) # altogether | 293 'c8df6478-d7794217-0f11c293-a41237c9-31d98357' ], |
294 'Synchronous' : True }))) # altogether | |
290 | 295 |
291 | 296 |
292 def test_server_retrieve(self): | 297 def test_server_retrieve(self): |
293 COUNT = 'ReceivedInstancesCount' | 298 COUNT = 'ReceivedInstancesCount' |
294 #COUNT = 'Instances' # In version <= 0.6 | 299 #COUNT = 'Instances' # In version <= 0.6 |
698 self.assertEqual(1, len(s['hello']['HttpHeaders'])) | 703 self.assertEqual(1, len(s['hello']['HttpHeaders'])) |
699 self.assertTrue('Hello' in s['hello']['HttpHeaders']) | 704 self.assertTrue('Hello' in s['hello']['HttpHeaders']) |
700 self.assertEqual('Test', s['hello']['UserProperty']) | 705 self.assertEqual('Test', s['hello']['UserProperty']) |
701 | 706 |
702 DoDelete(ORTHANC, '/dicom-web/servers/hello') | 707 DoDelete(ORTHANC, '/dicom-web/servers/hello') |
708 | |
709 | |
710 def test_bitbucket_issue_143(self): | |
711 # WADO-RS metadata request returns "500 Internal Server Error" | |
712 # instead of "404 Not Found" for missing instance | |
713 # https://bitbucket.org/sjodogne/orthanc/issues/143 | |
714 UploadInstance(ORTHANC, 'Issue143.dcm') | |
715 | |
716 try: | |
717 DoGet(ORTHANC, '/dicom-web/studies/1.2.840.113619.2.55.3.671756986.106.1316467036.460/series/1.2.840.113619.2.55.3.671756986.106.1316467036.465/instances/0.0.0.0.0/metadata') | |
718 self.assertFail() | |
719 except Exception as e: | |
720 self.assertEqual(404, e[0]) | |
721 | |
722 DoGet(ORTHANC, '/dicom-web/studies/1.3.6.1.4.1.34261.90254037371867.41912.1553085024.2/series/1.3.6.1.4.1.34261.90254037371867.41912.1553085024.3/instances/1.2.276.0.7230010.3.1.4.253549293.36648.1555586123.754/metadata') | |
723 | |
724 try: | |
725 DoGet(ORTHANC, '/dicom-web/studies/0.0.0.0.0/series/1.3.6.1.4.1.34261.90254037371867.41912.1553085024.3/instances/1.2.276.0.7230010.3.1.4.253549293.36648.1555586123.754/metadata') | |
726 self.fail() | |
727 except Exception as e: | |
728 self.assertEqual(404, e[0]) | |
729 | |
730 try: | |
731 DoGet(ORTHANC, '/dicom-web/studies/1.3.6.1.4.1.34261.90254037371867.41912.1553085024.2/series/0.0.0.0.0/instances/1.2.276.0.7230010.3.1.4.253549293.36648.1555586123.754/metadata') | |
732 self.assertFail() | |
733 except Exception as e: | |
734 self.assertEqual(404, e[0]) | |
735 | |
736 try: | |
737 DoGet(ORTHANC, '/dicom-web/studies/0.0.0.0.0/series/0.0.0.0.0/instances/0.0.0.0.0/metadata') | |
738 self.assertFail() | |
739 except Exception as e: | |
740 self.assertEqual(404, e[0]) | |
741 | |
703 | 742 |
704 try: | 743 try: |
705 print('\nStarting the tests...') | 744 print('\nStarting the tests...') |
706 unittest.main(argv = [ sys.argv[0] ] + args.options) | 745 unittest.main(argv = [ sys.argv[0] ] + args.options) |
707 | 746 |