def test_private_url_without_install(self): with pytest.raises( StateCheckError, message= 'Executing info action without install should raise an error'): vdisk = Vdisk(name='vdisk', data=self.valid_data) vdisk.url()
def test_url(self): vdisk = Vdisk(name='vdisk', data=self.valid_data) vdisk.data['nsName'] = 'ns_name' vdisk.state.set('actions', 'install', 'ok') vdisk.api = MagicMock() vdisk._zerodb.schedule_action = MagicMock( return_value=task_mock('url')) assert vdisk.url() == 'url' vdisk._zerodb.schedule_action.assert_called_once_with( 'namespace_url', args={'name': 'ns_name'})