def keys(self):
return [i[0] for i in self.iteritems()]
+ def values(self):
+ return [i[1] for i in self.iteritems()]
+
def __len__(self):
return len(self._data['items'])
self.delete_item_by_id(queue_item.id)
def delete_item_by_id(self, item_id):
- deleteurl = urlparse.urljoin(self.baseurl,
- 'cancelItem?id=%s' % item_id)
- try:
- self.post_data(deleteurl, '')
- except urllib2.HTTPError:
- # The request doesn't have a response, so it returns 404,
- # it's the expected behaviour
- pass
+ deleteurl = '%s/cancelItem?id=%s' % (self.baseurl, item_id)
+ self.get_jenkins_obj().requester.post_url(deleteurl)
class QueueItem(object):
reprString = repr(queue)
self.assertIn(queue.baseurl, reprString)
+ for queueId, item in queue.iteritems():
+ queue.delete_item(item)
+
+ queue.poll()
+
+ self.assertEquals(len(queue), 0)
+
+
def test_start_and_stop_long_running_job(self):
job_name = random_string()
j = self.jenkins.create_job(job_name, LONG_RUNNING_JOB)