def __str__(self):
return "Jenkins server at %s" % self.baseurl
+ @property
def views(self):
return Views(self)
def get_nested_view_dict(self):
return dict(self._get_nested_views())
+ @property
def views(self):
return self.get_jenkins_obj().get_jenkins_obj_from_url(self.baseurl).views()
raise TypeError('Job %s does not exist in Jenkins')
def __getitem__(self, view_name):
- for row in self.jenkins._data['views']:
+ for row in self.jenkins._data.get('views', []):
if row['name'] == view_name:
return View(
row['url'],
Get the names & objects for all views
"""
self.jenkins.poll()
- for row in self.jenkins._data['views']:
+ for row in self.jenkins._data.get('views', []):
name = row['name']
url = row['url']
username='foouser', password='foopassword',
requester=mock_requester)
- new_view = J.views().create('NewView')
+ new_view = J.views.create('NewView')
self.assertTrue(isinstance(new_view, View))
self.assertEquals(new_view.baseurl,
'http://localhost:8080/views/NewView')
username='foouser',
password='foopassword')
- new_view = J.views().create('NewView')
+ new_view = J.views.create('NewView')
self.assertIsInstance(new_view, View)