Files
python-jenkins/tests/jobs/test_set_next_build_number.py
Steve Kowalik c379366983 Stop using external mock module
Now that support for Python 2 has been dropped, we can switch to the
built-in unittest.mock module and drop one more external test
dependency.

Change-Id: Ie6e3b2c4047d00509053769fd5b49a1e4464e951
2025-06-25 16:04:05 +10:00

20 lines
609 B
Python

from unittest.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].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)