4 class Mocker(unittest.TestCase):
5 ACTIVE_TOKEN = '3kg6k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi'
8 'arvados_api_host': 'zzzzz.api_host.example',
9 'virtual_machine_hostname': 'testvm2.shell',
13 'token': ACTIVE_TOKEN,
19 'uuid': 'zzzzz-o0j2j-rah2ya1ohx9xaev',
20 'tail_uuid': 'zzzzz-tpzed-xurymjxw79nv3jz',
21 'head_uuid': 'zzzzz-2x53u-382brsig8rp3065',
22 'link_class': 'permission',
30 'uuid': 'zzzzz-tpzed-xurymjxw79nv3jz',
31 'full_name': 'Active User',
35 'uuid': 'zzzzz-2x53u-382brsig8rp3065',
36 'hostname': 'testvm2.shell',
43 self.config = self.default_config.copy()
44 self.request = self.default_request.copy()
45 self.response = self.default_response.copy()
46 self.api_client = mock.MagicMock(name='api_client')
47 self.api_client.users().current().execute.side_effect = lambda: self.response['users']
48 self.api_client.virtual_machines().list().execute.side_effect = lambda: self.response['virtual_machines']
49 self.api_client.links().list().execute.side_effect = lambda: self.response['links']
50 patcher = mock.patch('arvados.api')
51 self.api = patcher.start()
52 self.addCleanup(patcher.stop)
53 self.api.side_effect = [self.api_client]
56 patcher = mock.patch('syslog.syslog')
57 self.syslog = patcher.start()
58 self.addCleanup(patcher.stop)
59 self.syslog.side_effect = lambda s: self.syslogged.append(s)