# HG changeset patch # User Sebastien Jodogne # Date 1542106489 -3600 # Node ID e244312964d62ba91832ba95173443b3285cc2ae # Parent 76747a374affdea27d0e8c2958eae7d0678ac652 test_bitbucket_issue_111 diff -r 76747a374aff -r e244312964d6 Plugins/DicomWeb/Run.py --- 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)