1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
8 class Mocker(unittest.TestCase):
9 ACTIVE_TOKEN = '3kg6k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi'
12 'arvados_api_host': 'zzzzz.api_host.example',
13 'virtual_machine_hostname': 'testvm2.shell',
17 'token': ACTIVE_TOKEN,
23 'uuid': 'zzzzz-o0j2j-rah2ya1ohx9xaev',
24 'tail_uuid': 'zzzzz-tpzed-xurymjxw79nv3jz',
25 'head_uuid': 'zzzzz-2x53u-382brsig8rp3065',
26 'link_class': 'permission',
34 'uuid': 'zzzzz-tpzed-xurymjxw79nv3jz',
35 'full_name': 'Active User',
39 'uuid': 'zzzzz-2x53u-382brsig8rp3065',
40 'hostname': 'testvm2.shell',
47 self.config = self.default_config.copy()
48 self.request = self.default_request.copy()
49 self.response = self.default_response.copy()
50 self.api_client = mock.MagicMock(name='api_client')
51 self.api_client.users().current().execute.side_effect = lambda: self.response['users']
52 self.api_client.virtual_machines().list().execute.side_effect = lambda: self.response['virtual_machines']
53 self.api_client.links().list().execute.side_effect = lambda: self.response['links']
54 patcher = mock.patch('arvados.api')
55 self.api = patcher.start()
56 self.addCleanup(patcher.stop)
57 self.api.side_effect = [self.api_client]
60 patcher = mock.patch('syslog.syslog')
61 self.syslog = patcher.start()
62 self.addCleanup(patcher.stop)
63 self.syslog.side_effect = lambda s: self.syslogged.append(s)