# HG changeset patch # User Sebastien Jodogne # Date 1434983348 -7200 # Node ID 8f4b70c89467fc5adc0e8e4eaa8a82ba06eedd1e # Parent 2a29bcff60a721fb72cc8afefefc6a67a78a4be9 readme diff -r 2a29bcff60a7 -r 8f4b70c89467 GenerateConfigurationForTests.py --- a/GenerateConfigurationForTests.py Mon Jun 22 14:14:37 2015 +0200 +++ b/GenerateConfigurationForTests.py Mon Jun 22 16:29:08 2015 +0200 @@ -75,6 +75,7 @@ config = re.sub(r'("RemoteAccessAllowed"\s*:)\s*false', r'\1 true', config) config = re.sub(r'("AuthenticationEnabled"\s*:)\s*false', r'\1 true', config) config = re.sub(r'("DicomAssociationCloseDelay"\s*:)\s*[0-9]*', r'\1 0', config) +config = re.sub(r'("DefaultEncoding"\s*:)\s*".*?"', r'\1 "Windows1251"', config) # For test_issue_32 config = re.sub(r'("RegisteredUsers"\s*:)\s*{', r'\1 { "alice" : "orthanctest"', config) config = re.sub(r'("DicomModalities"\s*:)\s*{', r'\1 { "orthanctest" : [ "%s", "%s", %d ]' % ('ORTHANCTEST', ip, 5001), config) diff -r 2a29bcff60a7 -r 8f4b70c89467 README --- a/README Mon Jun 22 14:14:37 2015 +0200 +++ b/README Mon Jun 22 16:29:08 2015 +0200 @@ -7,32 +7,61 @@ This repository contains the integration tests that are used to validate Orthanc before each official release, in complement to the -unit tests that are part of the Orthanc repository. These integrations -tests should be run by the package maintainers of the various -platforms supported by Orthanc. +unit tests that are part of the Orthanc core repository. These +integration tests should be run by the package maintainers of the +various platforms supported by Orthanc. General information about Orthanc can be found on its official Website: http://www.orthanc-server.com/ +Quick-start: Running tests on the localhost +=========================================== + +This section explains how to run the integration tests in the simplest +framework. First, install Orthanc. Then, open 2 command shells and +run the instructions that follow: + +1. In the first command shell: + +# python ./GenerateConfigurationForTests.py --force +# Orthanc IntegrationTestsConfiguration.json + +2. In the second command shell: + +# python ./Tests/Run.py + + + Running the tests ================= The integration tests are written in Python and are started by the -"./Tests/Run.py" script. The tests will validate a "remote" instance -of Orthanc (whose AET is "ORTHANC") that is assumed to be running -before the tests are started. To test the DICOM protocol, a second, -"local" instance of Orthanc is automatically started by the -integration tests (its AET is "ORTHANCTEST"). This situation is -depicted on the following illustration: +"./Tests/Run.py" script. The tests will validate some "remote" +instance of Orthanc (whose AET is "ORTHANC") that is assumed to be +running before the tests are started. + +To test the DICOM protocol, a second, "local" instance of Orthanc is +automatically started by the integration tests (its AET is +"ORTHANCTEST"). This situation is depicted on the following +illustration: + -+--------------------------+ +-----------------------+ -| Local computer | | Remote computer | -+--------------------------+ HTTP +-----------------------+ -| | 5000 : 8042 | | -| Run.py <---> ORTHANCTEST <=============> ORTHANC | -| | 5001 : 4242 | | -+--------------------------+ DICOM +-----------------------+ ++--------------------------+ +-----------------------+ +| Local computer | | Remote computer | ++--------------------------+ HTTP +-----------------------+ +| | 5000 : 8042 | | +| Run.py <---> ORTHANCTEST <===============> ORTHANC | +| | 5001 : 4242 | | ++--------------------------+ DICOM +-----------------------+ + + +Obviously, Orthanc must be installed both on the local and remote +computers. + +NB: Of course, the "local" and "remote" computers are allowed be the +same computer. + 1. Configure the remote Orthanc @@ -41,14 +70,14 @@ To run the integration tests, you first have to create a configuration file for the remote instance of Orthanc. This is done by running the "./GenerateConfigurationForTests.py" script on the *local* -computer. This script will autodetect the proper network parameters. -For instance (a help is available): +computer. This script will try and autodetect the proper network +parameters. For instance (a help is available): # ./GenerateConfigurationForTests.py --force This will create the "./IntegrationTestsConfiguration.json" configuration file that must be copied to the remote computer. Then, -start Orthanc on the remote computer with this configuration file. +start Orthanc on the remote computer using this configuration file. By default, the configuration file will use "ORTHANC" as the AET, 8042 as the HTTP port, and 4242 as the DICOM port. You can of course @@ -57,6 +86,32 @@ +2. Start the integration tests on the local computer +---------------------------------------------------- + +Once the remote instance of Orthanc is up and running, you can start +the integration tests. You have 2 possibilities: (a) use your local +computer as is, or (b) use Docker to have the best reproducibility. + + +(Option 2a) Without Docker: + +# python ./Tests/Run.py + +Use the flag "--help" to get the full list of arguments. These +arguments will notably allow you to specify the network parameters +of your remote instance of Orthanc. + + +(Option 2b) With Docker: + +# sudo docker pull jodogne/orthanc-tests +# ./Start.sh + +Note that you will have to grant root access for Docker. + + + Licensing ========= diff -r 2a29bcff60a7 -r 8f4b70c89467 Tests/Tests.py --- a/Tests/Tests.py Mon Jun 22 14:14:37 2015 +0200 +++ b/Tests/Tests.py Mon Jun 22 16:29:08 2015 +0200 @@ -1,3 +1,7 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium @@ -1965,3 +1969,17 @@ self.AssertSameImages(tmp, '/instances/%s/preview' % signed) self.assertEqual('b57e6c872a3da50877c7da689b03a444', ComputeMD5(DoGet(_REMOTE, '/instances/%s/matlab' % signed))) + + + def test_issue_32(self): + f = UploadInstance(_REMOTE, 'Issue32.dcm')['ID'] + tags = DoGet(_REMOTE, '/instances/%s/tags?simplify' % f) + self.assertEqual(u'Рентгенография', tags['SeriesDescription']) + self.assertEqual(u'Таз', tags['BodyPartExamined']) + self.assertEqual(u'Прямая', tags['ViewPosition']) + + + def test_encodings(self): + brainix = UploadInstance(_REMOTE, 'Brainix/Epi/IM-0001-0001.dcm')['ID'] + tags = DoGet(_REMOTE, '/instances/%s/tags?simplify' % brainix) + self.assertEqual(u'IRM cérébrale, neuro-crâne', tags['StudyDescription'])