comparison Tests/Tests.py @ 136:5634ef96fcc5

testing "short" option
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 May 2018 10:07:39 +0200
parents f0d4c4707e64
children 412d5f70447e
comparison
equal deleted inserted replaced
135:6943b41eb239 136:5634ef96fcc5
191 self.assertEqual(2472, len(dicom)) 191 self.assertEqual(2472, len(dicom))
192 self.assertEqual('3e29b869978b6db4886355a2b1132124', ComputeMD5(dicom)) 192 self.assertEqual('3e29b869978b6db4886355a2b1132124', ComputeMD5(dicom))
193 self.assertEqual(1, len(DoGet(_REMOTE, '/instances/%s/frames' % i))) 193 self.assertEqual(1, len(DoGet(_REMOTE, '/instances/%s/frames' % i)))
194 self.assertEqual('TWINOW', DoGet(_REMOTE, '/instances/%s/simplified-tags' % i)['StationName']) 194 self.assertEqual('TWINOW', DoGet(_REMOTE, '/instances/%s/simplified-tags' % i)['StationName'])
195 self.assertEqual('TWINOW', DoGet(_REMOTE, '/instances/%s/tags' % i)['0008,1010']['Value']) 195 self.assertEqual('TWINOW', DoGet(_REMOTE, '/instances/%s/tags' % i)['0008,1010']['Value'])
196 self.assertEqual('TWINOW', DoGet(_REMOTE, '/instances/%s/tags?simplify' % i)['StationName'])
197 self.assertEqual('TWINOW', DoGet(_REMOTE, '/instances/%s/tags?short' % i)['0008,1010'])
196 198
197 199
198 def test_images(self): 200 def test_images(self):
199 i = UploadInstance(_REMOTE, 'Phenix/IM-0001-0001.dcm')['ID'] 201 i = UploadInstance(_REMOTE, 'Phenix/IM-0001-0001.dcm')['ID']
200 self.assertEqual(1, len(DoGet(_REMOTE, '/instances/%s/frames' % i))) 202 self.assertEqual(1, len(DoGet(_REMOTE, '/instances/%s/frames' % i)))
1354 b = UploadInstance(_REMOTE, 'Knee/T1/IM-0001-0002.dcm')['ID'] 1356 b = UploadInstance(_REMOTE, 'Knee/T1/IM-0001-0002.dcm')['ID']
1355 p = DoGet(_REMOTE, '/patients')[0] 1357 p = DoGet(_REMOTE, '/patients')[0]
1356 1358
1357 self.assertTrue('0010,0010' in DoGet(_REMOTE, '/patients/%s/shared-tags' % p)) 1359 self.assertTrue('0010,0010' in DoGet(_REMOTE, '/patients/%s/shared-tags' % p))
1358 self.assertTrue('PatientName' in DoGet(_REMOTE, '/patients/%s/shared-tags?simplify' % p)) 1360 self.assertTrue('PatientName' in DoGet(_REMOTE, '/patients/%s/shared-tags?simplify' % p))
1361 self.assertTrue('0010,0010' in DoGet(_REMOTE, '/patients/%s/shared-tags?short' % p))
1362
1363 self.assertEqual('KNEE', DoGet(_REMOTE, '/patients/%s/shared-tags' % p)['0010,0010']['Value'])
1364 self.assertEqual('KNEE', DoGet(_REMOTE, '/patients/%s/shared-tags?simplify' % p)['PatientName'])
1365 self.assertEqual('KNEE', DoGet(_REMOTE, '/patients/%s/shared-tags?short' % p)['0010,0010'])
1366
1359 self.assertTrue('0008,1030' in DoGet(_REMOTE, '/patients/%s/shared-tags' % p)) 1367 self.assertTrue('0008,1030' in DoGet(_REMOTE, '/patients/%s/shared-tags' % p))
1360 self.assertTrue('StudyDescription' in DoGet(_REMOTE, '/patients/%s/shared-tags?simplify' % p)) 1368 self.assertTrue('StudyDescription' in DoGet(_REMOTE, '/patients/%s/shared-tags?simplify' % p))
1361 self.assertTrue('0008,103e' in DoGet(_REMOTE, '/patients/%s/shared-tags' % p)) 1369 self.assertTrue('0008,103e' in DoGet(_REMOTE, '/patients/%s/shared-tags' % p))
1362 self.assertTrue('SeriesDescription' in DoGet(_REMOTE, '/patients/%s/shared-tags?simplify' % p)) 1370 self.assertTrue('SeriesDescription' in DoGet(_REMOTE, '/patients/%s/shared-tags?simplify' % p))
1363 self.assertFalse('0008,0018' in DoGet(_REMOTE, '/patients/%s/shared-tags' % p)) 1371 self.assertFalse('0008,0018' in DoGet(_REMOTE, '/patients/%s/shared-tags' % p))
1785 1793
1786 i = DoGet(_REMOTE, '/patients/%s/instances-tags?simplify' % DoGet(_REMOTE, '/series')[1]) 1794 i = DoGet(_REMOTE, '/patients/%s/instances-tags?simplify' % DoGet(_REMOTE, '/series')[1])
1787 self.assertEqual(1, len(i)) 1795 self.assertEqual(1, len(i))
1788 self.assertEqual('887', i[i.keys()[0]]['PatientID']) 1796 self.assertEqual('887', i[i.keys()[0]]['PatientID'])
1789 1797
1798 i = DoGet(_REMOTE, '/patients/%s/instances-tags?short' % DoGet(_REMOTE, '/series')[1])
1799 self.assertEqual(1, len(i))
1800 self.assertEqual('887', i[i.keys()[0]]['0010,0020'])
1801
1790 1802
1791 def test_lookup(self): 1803 def test_lookup(self):
1792 a = DoPost(_REMOTE, '/tools/lookup', 'ozp00SjY2xG') 1804 a = DoPost(_REMOTE, '/tools/lookup', 'ozp00SjY2xG')
1793 self.assertEqual(0, len(a)) 1805 self.assertEqual(0, len(a))
1794 1806
1988 2000
1989 knixStudy = 'b9c08539-26f93bde-c81ab0d7-bffaf2cb-a4d0bdd0' 2001 knixStudy = 'b9c08539-26f93bde-c81ab0d7-bffaf2cb-a4d0bdd0'
1990 i = UploadInstance(_REMOTE, 'Knix/Loc/IM-0001-0001.dcm')['ID'] 2002 i = UploadInstance(_REMOTE, 'Knix/Loc/IM-0001-0001.dcm')['ID']
1991 2003
1992 # This is JPEG lossless 2004 # This is JPEG lossless
2005 self.assertEqual('1.2.840.10008.1.2.4.70', DoGet(_REMOTE, '/instances/%s/header' % i)['0002,0010']['Value'])
1993 self.assertEqual('1.2.840.10008.1.2.4.70', DoGet(_REMOTE, '/instances/%s/header?simplify' % i)['TransferSyntaxUID']) 2006 self.assertEqual('1.2.840.10008.1.2.4.70', DoGet(_REMOTE, '/instances/%s/header?simplify' % i)['TransferSyntaxUID'])
2007 self.assertEqual('1.2.840.10008.1.2.4.70', DoGet(_REMOTE, '/instances/%s/header?short' % i)['0002,0010'])
1994 2008
1995 UploadInstance(_REMOTE, 'Knix/Loc/IM-0001-0002.dcm') 2009 UploadInstance(_REMOTE, 'Knix/Loc/IM-0001-0002.dcm')
1996 UploadInstance(_REMOTE, 'Knix/Loc/IM-0001-0003.dcm') 2010 UploadInstance(_REMOTE, 'Knix/Loc/IM-0001-0003.dcm')
1997 2011
1998 a = UploadInstance(_REMOTE, 'Brainix/Flair/IM-0001-0001.dcm')['ID'] 2012 a = UploadInstance(_REMOTE, 'Brainix/Flair/IM-0001-0001.dcm')['ID']