def test_release_workflow_that_is_not_on_hold_returns_error(self, mock_request):
        workflow_id = 'test'

        def _request_callback(request, context):
            context.status_code = 403
            context.headers['test'] = 'header'
            return {
                'status': 'error',
                'message': 'Couldn\'t change status of workflow {} to \'Submitted\' because the workflow is not in '
                '\'On Hold\' state'.format(request.url.split('/')[-2]),
            }

        for cromwell_auth in self.auth_options:
            mock_request.post(
                '{0}/api/workflows/v1/{1}/releaseHold'.format(
                    cromwell_auth.url, workflow_id
                ),
                json=_request_callback,
            )
            with self.assertRaises(requests.exceptions.HTTPError):
                CromwellAPI.release_hold(workflow_id, cromwell_auth).raise_for_status()
    def test_release_onhold_returns_200(self, mock_request):
        workflow_id = '12345abcde'

        def _request_callback(request, context):
            context.status_code = 200
            context.headers['test'] = 'header'
            return {'id': request.url.split('/')[-2], 'status': 'Submitted'}

        for cromwell_auth in self.auth_options:
            mock_request.post(
                '{0}/api/workflows/v1/{1}/releaseHold'.format(
                    cromwell_auth.url, workflow_id),
                json=_request_callback,
            )
            result = CromwellAPI.release_hold(workflow_id, cromwell_auth)
            self.assertEqual(result.status_code, 200)
            self.assertEqual(result.json()['id'], workflow_id)
            self.assertEqual(result.json()['status'], 'Submitted')