changeset 184:e244312964d6

test_bitbucket_issue_111
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Nov 2018 11:54:49 +0100
parents 76747a374aff
children d4a5e4143d68
files Plugins/DicomWeb/Run.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/DicomWeb/Run.py	Thu Oct 18 12:04:06 2018 +0200
+++ b/Plugins/DicomWeb/Run.py	Tue Nov 13 11:54:49 2018 +0100
@@ -329,6 +329,27 @@
         self.assertTrue(knee in b)
 
 
+    def test_bitbucket_issue_111(self):
+        # According to the standard, section F.2.5
+        # (http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_F.2.5.html),
+        # null values behave as follows: If an attribute is present in
+        # DICOM but empty (i.e., Value Length is 0), it shall be
+        # preserved in the DICOM JSON attribute object containing no
+        # "Value", "BulkDataURI" or "InlineBinary".
+        # https://bitbucket.org/sjodogne/orthanc/issues/111/qido-rs-wrong-serialization-of-empty
+
+        UploadInstance(ORTHANC, 'ColorTestMalaterre.dcm')
+
+        a = DoGet(ORTHANC, '/dicom-web/studies',
+                  headers = { 'accept' : 'application/json' })
+
+        pprint.pprint(a)
+        
+        self.assertEqual(1, len(a))
+        self.assertTrue('00080050' in a[0])  # AccessionNumber is null
+        self.assertEqual(1, len(a[0]['00080050']))  # 'vr' is the only field to be present
+        self.assertEqual('SH', a[0]['00080050']['vr'])
+
 try:
     print('\nStarting the tests...')
     unittest.main(argv = [ sys.argv[0] ] + args.options)