summaryrefslogtreecommitdiffstats
path: root/tests/cmd
diff options
context:
space:
mode:
authorWayne Warren <waynr+launchpad@sdf.org>2016-01-02 00:17:00 -0800
committerWayne Warren <waynr+launchpad@sdf.org>2016-08-05 08:32:51 -0700
commit99fd0840998e83eef6ddc63d69798208d8f04eae (patch)
tree6415d5c8defb0efb80b8b796dd83477610087040 /tests/cmd
parent73732018824fb7a34b5831a9f4e5816cd8f9499e (diff)
downloadpython-jenkins-job-builder-99fd0840998e83eef6ddc63d69798208d8f04eae.tar.gz
python-jenkins-job-builder-99fd0840998e83eef6ddc63d69798208d8f04eae.tar.xz
python-jenkins-job-builder-99fd0840998e83eef6ddc63d69798208d8f04eae.zip
Move subcommand logic into subcommand classes.
Also, add copyright notices to subcommand files and fix mock import paths in tests. Change-Id: Ia8a96d5d5c460387968437d86cf7144ef382b20c
Diffstat (limited to 'tests/cmd')
-rw-r--r--tests/cmd/subcommands/test_delete.py4
-rw-r--r--tests/cmd/subcommands/test_test.py4
-rw-r--r--tests/cmd/subcommands/test_update.py8
3 files changed, 8 insertions, 8 deletions
diff --git a/tests/cmd/subcommands/test_delete.py b/tests/cmd/subcommands/test_delete.py
index 222aa028..3dfd6417 100644
--- a/tests/cmd/subcommands/test_delete.py
+++ b/tests/cmd/subcommands/test_delete.py
@@ -27,7 +27,7 @@ from tests.cmd.test_cmd import CmdTestsBase
@mock.patch('jenkins_jobs.builder.Jenkins.get_plugins_info', mock.MagicMock)
class DeleteTests(CmdTestsBase):
- @mock.patch('jenkins_jobs.cli.entry.Builder.delete_job')
+ @mock.patch('jenkins_jobs.cli.subcommand.delete.Builder.delete_job')
def test_delete_single_job(self, delete_job_mock):
"""
Test handling the deletion of a single Jenkins job.
@@ -36,7 +36,7 @@ class DeleteTests(CmdTestsBase):
args = ['--conf', self.default_config_file, 'delete', 'test_job']
self.execute_jenkins_jobs_with_args(args)
- @mock.patch('jenkins_jobs.cli.entry.Builder.delete_job')
+ @mock.patch('jenkins_jobs.cli.subcommand.delete.Builder.delete_job')
def test_delete_multiple_jobs(self, delete_job_mock):
"""
Test handling the deletion of multiple Jenkins jobs.
diff --git a/tests/cmd/subcommands/test_test.py b/tests/cmd/subcommands/test_test.py
index f4305ab6..c18a5910 100644
--- a/tests/cmd/subcommands/test_test.py
+++ b/tests/cmd/subcommands/test_test.py
@@ -130,7 +130,7 @@ class TestTests(CmdTestsBase):
e = self.assertRaises(UnicodeError, jenkins_jobs.execute)
self.assertIn("'ascii' codec can't encode character", str(e))
- @mock.patch('jenkins_jobs.cli.entry.YamlParser.generateXML')
+ @mock.patch('jenkins_jobs.cli.subcommand.test.YamlParser.generateXML')
@mock.patch('jenkins_jobs.parser.ModuleRegistry')
def test_plugins_info_stub_option(self, registry_mock, generateXML_mock):
"""
@@ -154,7 +154,7 @@ class TestTests(CmdTestsBase):
registry_mock.assert_called_with(mock.ANY,
plugins_info_list)
- @mock.patch('jenkins_jobs.cli.entry.YamlParser.generateXML')
+ @mock.patch('jenkins_jobs.cli.subcommand.test.YamlParser.generateXML')
@mock.patch('jenkins_jobs.parser.ModuleRegistry')
def test_bogus_plugins_info_stub_option(self, registry_mock,
generateXML_mock):
diff --git a/tests/cmd/subcommands/test_update.py b/tests/cmd/subcommands/test_update.py
index a9c3a165..8b91c981 100644
--- a/tests/cmd/subcommands/test_update.py
+++ b/tests/cmd/subcommands/test_update.py
@@ -122,8 +122,8 @@ class UpdateTests(CmdTestsBase):
path = os.path.join(self.fixtures_path, 'cmd-002.yaml')
args = ['--conf', self.default_config_file, 'update', path]
- with mock.patch(
- 'jenkins_jobs.cli.entry.Builder.update_job') as update_mock:
+ import_path = 'jenkins_jobs.cli.subcommand.update.Builder.update_job'
+ with mock.patch(import_path) as update_mock:
update_mock.return_value = ([], 0)
self.execute_jenkins_jobs_with_args(args)
# unless the timeout is set, should only call with 3 arguments
@@ -143,8 +143,8 @@ class UpdateTests(CmdTestsBase):
'non-default-timeout.ini')
args = ['--conf', config_file, 'update', path]
- with mock.patch(
- 'jenkins_jobs.cli.entry.Builder.update_job') as update_mock:
+ import_path = 'jenkins_jobs.cli.subcommand.update.Builder.update_job'
+ with mock.patch(import_path) as update_mock:
update_mock.return_value = ([], 0)
self.execute_jenkins_jobs_with_args(args)
# when timeout is set, the fourth argument to the Jenkins api init