1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 from __future__ import absolute_import
8 # ARVADOS_API_TOKEN=abc ARVADOS_API_HOST=arvados.local python -m unittest discover
13 from . import run_test_server
15 class PipelineTemplateTest(run_test_server.TestCaseWithServers):
20 run_test_server.authorize_with("admin")
21 pt_uuid = arvados.api('v1').pipeline_templates().create(
22 body={'name':__file__}
24 self.assertEqual(len(pt_uuid), 27,
25 'Unexpected format of pipeline template UUID ("%s")'
29 '-x-': [1,2,{'foo':'bar'}],
30 'Boggis': {'Bunce': '[\'Bean\']'},
33 'spass-box': [True, 'Maybe', False]
35 update_response = arvados.api('v1').pipeline_templates().update(
37 body={'components':components}
39 self.assertEqual('uuid' in update_response, True,
40 'update() response did not include a uuid')
41 self.assertEqual(update_response['uuid'], pt_uuid,
42 'update() response has a different uuid (%s, not %s)'
43 % (update_response['uuid'], pt_uuid))
44 self.assertEqual(update_response['name'], __file__,
45 'update() response has a different name (%s, not %s)'
46 % (update_response['name'], __file__))
47 get_response = arvados.api('v1').pipeline_templates().get(
50 self.assertEqual(get_response['components'], components,
51 'components got munged by server (%s -> %s)'
52 % (components, update_response['components']))
53 delete_response = arvados.api('v1').pipeline_templates().delete(
56 self.assertEqual(delete_response['uuid'], pt_uuid,
57 'delete() response has wrong uuid (%s, not %s)'
58 % (delete_response['uuid'], pt_uuid))
59 with self.assertRaises(apiclient.errors.HttpError):
60 geterror_response = arvados.api('v1').pipeline_templates().get(