Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
salt.3514
0070-Fix-some-unittests.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0070-Fix-some-unittests.patch of Package salt.3514
From e533fb418408471aed9d41bf528166d6335a2bd3 Mon Sep 17 00:00:00 2001 From: Mihai Dinca <mdinca@suse.de> Date: Tue, 23 Aug 2016 11:55:33 +0200 Subject: [PATCH 70/70] Fix some unittests PR: https://github.com/saltstack/salt/pull/35693 Fix tests/unit/modules/useradd_test.py::UserAddTestCase::test_info Fix unit/pyobjects_test.py::MapTests::test_map Fix tests/unit/pyobjects_test.py::RendererTests::test_extend Fix tests/unit/pyobjects_test.py::RendererTests::test_requisite_implicit_list --- tests/unit/modules/useradd_test.py | 6 ++---- tests/unit/pyobjects_test.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/unit/modules/useradd_test.py b/tests/unit/modules/useradd_test.py index 7e646b6..cc9e610 100644 --- a/tests/unit/modules/useradd_test.py +++ b/tests/unit/modules/useradd_test.py @@ -326,7 +326,7 @@ class UserAddTestCase(TestCase): ''' Test the user information ''' - self.assertEqual(useradd.info('salt'), {}) + self.assertEqual(useradd.info('username-that-doesnt-exist'), {}) mock = MagicMock(return_value=pwd.struct_passwd(('_TEST_GROUP', '*', @@ -336,9 +336,7 @@ class UserAddTestCase(TestCase): '/var/virusmails', '/usr/bin/false'))) with patch.object(pwd, 'getpwnam', mock): - mock = MagicMock(return_value='Group Name') - with patch.object(useradd, 'list_groups', mock): - self.assertEqual(useradd.info('salt')['name'], '_TEST_GROUP') + self.assertEqual(useradd.info('username-that-doesnt-exist')['name'], '_TEST_GROUP') # 'list_groups' function tests: 1 diff --git a/tests/unit/pyobjects_test.py b/tests/unit/pyobjects_test.py index f1c3e29..3eb4bd5 100644 --- a/tests/unit/pyobjects_test.py +++ b/tests/unit/pyobjects_test.py @@ -54,10 +54,18 @@ include('http') extend_template = '''#!pyobjects include('http') + +from salt.utils.pyobjects import StateFactory +Service = StateFactory('service') + Service.running(extend('apache'), watch=[{'file': '/etc/file'}]) ''' map_template = '''#!pyobjects +from salt.utils.pyobjects import StateFactory +Service = StateFactory('service') + + class Samba(Map): __merge__ = 'samba:lookup' @@ -127,6 +135,9 @@ from salt://password.sls import password ''' requisite_implicit_list_template = '''#!pyobjects +from salt.utils.pyobjects import StateFactory +Service = StateFactory('service') + with Pkg.installed("pkg"): Service.running("service", watch=File("file"), require=Cmd("cmd")) ''' -- 2.9.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor