# HG changeset patch # User Sebastien Jodogne # Date 1560281886 -7200 # Node ID 8980bd19e31d3f0ca1bb861e8dbd315877df4f85 # Parent 50c694cd5bbfc1b0321db26c4b740726fe95d625 dicomweb: test_allowed_methods diff -r 50c694cd5bbf -r 8980bd19e31d Plugins/DicomWeb/Run.py --- a/Plugins/DicomWeb/Run.py Wed May 29 17:49:02 2019 +0200 +++ b/Plugins/DicomWeb/Run.py Tue Jun 11 21:38:06 2019 +0200 @@ -641,6 +641,21 @@ self.assertEqual('SQ', a['00081199']['vr']) self.assertEqual(1, len(['00081199'])) + + def test_allowed_methods(self): + self.assertEqual(0, len(DoGet(ORTHANC, '/dicom-web/studies'))) + + with self.assertRaises(Exception) as e: + DoPut(ORTHANC, '/dicom-web/studies') + + self.assertEqual(405, e.exception[0]) + self.assertEqual("GET,POST", e.exception[1]['allow']) + + with self.assertRaises(Exception) as e: + DoDelete(ORTHANC, '/dicom-web/studies') + + self.assertEqual(405, e.exception[0]) + self.assertEqual("GET,POST", e.exception[1]['allow']) try: print('\nStarting the tests...') diff -r 50c694cd5bbf -r 8980bd19e31d Tests/Toolbox.py --- a/Tests/Toolbox.py Wed May 29 17:49:02 2019 +0200 +++ b/Tests/Toolbox.py Tue Jun 11 21:38:06 2019 +0200 @@ -111,7 +111,7 @@ (resp, content) = DoGetRaw(orthanc, uri, data = data, body = body, headers = headers) if not (resp.status in [ 200 ]): - raise Exception(resp.status) + raise Exception(resp.status, resp) else: return _DecodeJson(content) @@ -134,7 +134,7 @@ body = body, headers = headers) if not (resp.status in [ 200, 302 ]): - raise Exception(resp.status) + raise Exception(resp.status, resp) else: return _DecodeJson(content) @@ -145,7 +145,7 @@ resp, content = http.request(orthanc['Url'] + uri, 'DELETE') if not (resp.status in [ 200 ]): - raise Exception(resp.status) + raise Exception(resp.status, resp) else: return _DecodeJson(content)