comparison Tests/Tests.py @ 17:7c8500991a12

karsten
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 19 Jun 2015 08:56:52 +0200
parents 2e5dbbbe3889
children 16c37933384d
comparison
equal deleted inserted replaced
16:04fa104ab63b 17:7c8500991a12
986 i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', 'PatientName=anonymized' ]) 986 i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', 'PatientName=anonymized' ])
987 series = re.findall('\(0010,0010\).*?\[\s*(.*?)\s*\]', i) 987 series = re.findall('\(0010,0010\).*?\[\s*(.*?)\s*\]', i)
988 self.assertEqual(1, len(series)) 988 self.assertEqual(1, len(series))
989 989
990 990
991 @unittest.skip("This test fails, to fix")
992 def test_incoming_movescu(self): 991 def test_incoming_movescu(self):
993 def CallMoveScu(args): 992 def CallMoveScu(args):
994 subprocess.check_call([ 'movescu', 993 subprocess.check_call([ 'movescu',
995 '--move', _LOCAL['DicomAet'], # Target AET (i.e. storescp) 994 '--move', _LOCAL['DicomAet'], # Target AET (i.e. storescp)
996 '--call', _REMOTE['DicomAet'], # Called AET (i.e. Orthanc) 995 '--call', _REMOTE['DicomAet'], # Called AET (i.e. Orthanc)
997 '--aetitle', _LOCAL['DicomAet'], # Calling AET (i.e. storescp) 996 '--aetitle', _LOCAL['DicomAet'], # Calling AET (i.e. storescp)
998 _REMOTE['Server'], str(_REMOTE['DicomPort']) ] + args, 997 _REMOTE['Server'], str(_REMOTE['DicomPort']) ] + args,
999 stderr=subprocess.PIPE) 998 stderr=subprocess.PIPE)
1000 999
1001 UploadInstance(_REMOTE, 'Multiframe.dcm') 1000 UploadInstance(_REMOTE, 'Multiframe.dcm')
1002 1001
1003 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) 1002 self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
1004 #CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=none' ]) 1003 CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=none' ])
1005 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) 1004 self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
1006 CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=12345678' ]) 1005 CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=12345678' ])
1007 self.assertEqual(1, len(DoGet(_LOCAL, '/patients'))) 1006 self.assertEqual(1, len(DoGet(_LOCAL, '/patients')))
1008 1007
1009 1008
1713 f.flush() 1712 f.flush()
1714 routed = subprocess.check_output([ 'dcm2xml', f.name ]) 1713 routed = subprocess.check_output([ 'dcm2xml', f.name ])
1715 self.assertEqual('My Medical Device', re.search('"StationName">(.*?)<', routed).group(1).strip()) 1714 self.assertEqual('My Medical Device', re.search('"StationName">(.*?)<', routed).group(1).strip())
1716 self.assertEqual(None, re.search('"MilitaryRank"', routed)) 1715 self.assertEqual(None, re.search('"MilitaryRank"', routed))
1717 self.assertEqual(None, re.search('"0051,0010"', routed)) # A private tag 1716 self.assertEqual(None, re.search('"0051,0010"', routed)) # A private tag
1717
1718
1719 def test_storescu_rf(self):
1720 i = UploadInstance(_REMOTE, 'KarstenHilbertRF.dcm')['ID']
1721 self.assertEqual(0, len(DoGet(_LOCAL, '/instances')))
1722 j = DoPost(_REMOTE, '/modalities/orthanctest/store', str(i), 'text/plain')
1723 self.assertEqual(1, len(DoGet(_LOCAL, '/instances')))