changeset 378:a4b8450a1158

fix test_storescu_transcoding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Feb 2021 19:05:59 +0100
parents cc79fa4945da
children 097329b67509
files Tests/Run.py Tests/Tests.py
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Run.py	Thu Feb 04 15:31:11 2021 +0100
+++ b/Tests/Run.py	Thu Feb 11 19:05:59 2021 +0100
@@ -158,6 +158,17 @@
     print('\nStarting the tests...')
     SetOrthancParameters(LOCAL, REMOTE, args.docker)
 
+    # Change the order of the tests
+    # https://stackoverflow.com/a/4006044/881731
+    # https://stackoverflow.com/a/54923706/881731
+
+    # Reverse order
+    # unittest.TestLoader.sortTestMethodsUsing = lambda _, x, y: cmp(y, x)
+
+    # import random
+    # random.seed(25)
+    # unittest.TestLoader.sortTestMethodsUsing = lambda self, a, b: random.choice([1, 0, -1])
+    
     unittest.main(argv = [ sys.argv[0] ] + args.options)
 
 
--- a/Tests/Tests.py	Thu Feb 04 15:31:11 2021 +0100
+++ b/Tests/Tests.py	Thu Feb 11 19:05:59 2021 +0100
@@ -2980,6 +2980,13 @@
         t = DoGet(_REMOTE, '/instances/%s/tags' % j)
         with open(GetDatabasePath('PrivateTagsFull.json'), 'r') as f:
             a = json.loads(f.read())
+
+            # Starting with Orthanc 1.9.1, the DICOM-as-JSON
+            # attachments are truncated starting with PixelData
+            if not '7fe1,0010' in t:
+                del a['7fe1,0010']
+                del a['7fe1,1001']
+                
             aa = json.dumps(a).replace('2e+022', '2e+22')
             tt = (json.dumps(t)
                   .replace('2e+022', '2e+22')
@@ -5610,6 +5617,7 @@
         params['AllowTranscoding'] = False
         DoPut(_REMOTE, '/modalities/toto', params)
         self.assertRaises(Exception, lambda: DoPost(_REMOTE, '/modalities/toto/store', str(i), 'text/plain'))
+        DoDelete(_REMOTE, '/modalities/toto')
 
 
     def test_bitbucket_issue_169(self):