python-jenkins/tests/jobs/test_set_next_build_number.py
Darragh Bailey 2aa1a5f1b8 Use TestWithScenarios to add additional url tests
It's important to check that we correctly handle the server url for all
API calls, so ensure that the test code uses test scenarios to cover.

Fix get_info() api call creation of url.

Change-Id: Idb0becc4c0c56df81bc5545919e530b7a77dadc9
2015-12-02 11:35:59 -08:00

20 lines
611 B
Python

from mock import patch
import jenkins
from tests.jobs.base import JenkinsJobsTestBase
class JenkinsSetNextBuildNumberTest(JenkinsJobsTestBase):
@patch.object(jenkins.Jenkins, 'jenkins_open')
def test_simple(self, jenkins_mock):
self.j.set_next_build_number('TestJob', 1234)
self.assertEqual(
jenkins_mock.call_args[0][0].get_full_url(),
self.make_url('job/TestJob/nextbuildnumber/submit'))
self.assertEqual(
jenkins_mock.call_args[0][0].data,
b'nextBuildNumber=1234')
self._check_requests(jenkins_mock.call_args_list)