Mercurial > hg > orthanc-tests
comparison Tests/Tests.py @ 405:6bbc89c2c2d1
test_issue_146
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 03 Jun 2021 21:05:19 +0200 |
parents | e08e15befa0c |
children | 62ee5e57ee05 |
comparison
equal
deleted
inserted
replaced
404:931be0125954 | 405:6bbc89c2c2d1 |
---|---|
7022 self.assertEqual(1, len(instances)) | 7022 self.assertEqual(1, len(instances)) |
7023 | 7023 |
7024 tags = DoGet(_REMOTE, '/instances/%s/tags?short' % instances[0]['ID']) | 7024 tags = DoGet(_REMOTE, '/instances/%s/tags?short' % instances[0]['ID']) |
7025 self.assertTrue('0020,9165' in tags) | 7025 self.assertTrue('0020,9165' in tags) |
7026 self.assertEqual('0020,9056', tags['0020,9165']) | 7026 self.assertEqual('0020,9056', tags['0020,9165']) |
7027 | |
7028 | |
7029 def test_issue_146(self): | |
7030 # "Update Anonyization to 2019c" | |
7031 # https://bugs.orthanc-server.com/show_bug.cgi?id=146 | |
7032 | |
7033 def GetTags(study, params): | |
7034 a = DoPost(_REMOTE, '/studies/%s/anonymize' % study, params) ['ID'] | |
7035 b = DoGet(_REMOTE, '/studies/%s/instances' % a) | |
7036 self.assertEqual(1, len(b)) | |
7037 return DoGet(_REMOTE, '/instances/%s/tags?short' % b[0]['ID']) | |
7038 | |
7039 | |
7040 UploadInstance(_REMOTE, 'Issue146.dcm') | |
7041 study = '7c950970-321e4ab0-28446c5f-f94850f1-5c44634b' | |
7042 | |
7043 self.assertRaises(Exception, lambda: GetTags(study, { 'DicomVersion' : 'nope' })) | |
7044 | |
7045 tags2008 = GetTags(study, { 'DicomVersion' : '2008' }) | |
7046 tags2017c = GetTags(study, { 'DicomVersion' : '2017c' }) | |
7047 tags2021b = GetTags(study, { 'DicomVersion' : '2021b' }) | |
7048 tagsDefault = GetTags(study, {}) | |
7049 | |
7050 self.assertEqual('Orthanc mainline - PS 3.15-2008 Table E.1-1', tags2008['0012,0063']) | |
7051 self.assertEqual('Orthanc mainline - PS 3.15-2017c Table E.1-1 Basic Profile', tags2017c['0012,0063']) | |
7052 self.assertEqual('Orthanc mainline - PS 3.15-2021b Table E.1-1 Basic Profile', tags2021b['0012,0063']) | |
7053 self.assertEqual(tagsDefault['0012,0063'], tags2021b['0012,0063']) | |
7054 | |
7055 for t in [ tags2008, tags2017c, tags2021b, tagsDefault ]: | |
7056 self.assertTrue(t['0010,0010'].startswith('Anonymized')) | |
7057 self.assertEqual('1.2.840.10008.5.1.4.1.1.4', t['0008,0016']) | |
7058 self.assertEqual(36, len(t['0010,0020'])) # Length of a UUID | |
7059 self.assertEqual('YES', t['0012,0062']) | |
7060 | |
7061 for t in [ tags2008 ]: | |
7062 self.assertEqual('20200101', t['0008,0020']) | |
7063 | |
7064 for t in [ tags2017c, tags2021b, tagsDefault ]: | |
7065 self.assertEqual('', t['0008,0020']) # Study Date, anonymized between 2008 and 2017c | |
7066 | |
7067 for t in [ tags2008, tags2017c ]: | |
7068 self.assertEqual('HELLO^C', t['0050,0020']) | |
7069 self.assertEqual('HELLO^D', t['3006,0002']) | |
7070 | |
7071 for t in [ tags2021b, tagsDefault ]: | |
7072 self.assertFalse('0050,0020' in t) # Device Description, anonymized between 2017c and 2019c | |
7073 self.assertEqual('', t['3006,0002']) # StructureSetLabel, anonymized between 2019c and 2021b |