Skip to content

Commit d1de4dc

Browse files
author
Matei Albu
committed
fixup! Let dpkg.info expose package status
unit test
1 parent 7184e7d commit d1de4dc

File tree

1 file changed

+44
-46
lines changed

1 file changed

+44
-46
lines changed

tests/unit/modules/test_dpkg_lowpkg.py

+44-46
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
# Import Python libs
77
from __future__ import absolute_import, print_function, unicode_literals
8+
import os
89

910
# Import Salt Testing Libs
1011
from tests.support.mixins import LoaderModuleMockMixin
@@ -109,36 +110,37 @@ def test_info(self):
109110
'''
110111
mock = MagicMock(return_value={'retcode': 0,
111112
'stderr': '',
112-
'stdout': """
113-
package:bash
114-
revision:
115-
architecture:amd64
116-
maintainer:Ubuntu Developers <[email protected]>
117-
summary:
118-
source:bash
119-
version:4.4.18-2ubuntu1
120-
section:shells
121-
installed_size:1588
122-
size:
123-
MD5:
124-
SHA1:
125-
SHA256:
126-
origin:
127-
homepage:http://tiswww.case.edu/php/chet/bash/bashtop.html
128-
status:ii
129-
======
130-
description:GNU Bourne Again SHell
131-
Bash is an sh-compatible command language interpreter that executes
132-
commands read from the standard input or from a file. Bash also
133-
incorporates useful features from the Korn and C shells (ksh and csh).
134-
.
135-
Bash is ultimately intended to be a conformant implementation of the
136-
IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2).
137-
.
138-
The Programmable Completion Code, by Ian Macdonald, is now found in
139-
the bash-completion package.
140-
------
141-
"""})
113+
'stdout':
114+
os.linesep.join([
115+
'package:bash',
116+
'revision:',
117+
'architecture:amd64',
118+
'maintainer:Ubuntu Developers <[email protected]>',
119+
'summary:',
120+
'source:bash',
121+
'version:4.4.18-2ubuntu1',
122+
'section:shells',
123+
'installed_size:1588',
124+
'size:',
125+
'MD5:',
126+
'SHA1:',
127+
'SHA256:',
128+
'origin:',
129+
'homepage:http://tiswww.case.edu/php/chet/bash/bashtop.html',
130+
'status:ii ',
131+
'======',
132+
'description:GNU Bourne Again SHell',
133+
' Bash is an sh-compatible command language interpreter that executes',
134+
' commands read from the standard input or from a file. Bash also',
135+
' incorporates useful features from the Korn and C shells (ksh and csh).',
136+
' .',
137+
' Bash is ultimately intended to be a conformant implementation of the',
138+
' IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2).',
139+
' .',
140+
' The Programmable Completion Code, by Ian Macdonald, is now found in',
141+
' the bash-completion package.',
142+
'------'
143+
])})
142144

143145
with patch.dict(dpkg.__salt__, {'cmd.run_all': mock}), \
144146
patch.dict(dpkg.__grains__, {'os': 'Ubuntu', 'osrelease_info': (18, 4)}), \
@@ -147,22 +149,18 @@ def test_info(self):
147149
patch('os.path.getmtime', MagicMock(return_value=1560199259.0)):
148150
self.assertDictEqual(dpkg.info('bash'),
149151
{'bash': {'architecture': 'amd64',
150-
'description': 'GNU Bourne Again SHell\n'
151-
' Bash is an sh-compatible command language '
152-
'interpreter that executes\n'
153-
' commands read from the standard input or from a '
154-
'file. Bash also\n'
155-
' incorporates useful features from the Korn and C '
156-
'shells (ksh and csh).\n'
157-
' .\n'
158-
' Bash is ultimately intended to be a conformant '
159-
'implementation of the\n'
160-
' IEEE POSIX Shell and Tools specification (IEEE '
161-
'Working Group 1003.2).\n'
162-
' .\n'
163-
' The Programmable Completion Code, by Ian Macdonald, '
164-
'is now found in\n'
165-
' the bash-completion package.\n',
152+
'description': os.linesep.join([
153+
'GNU Bourne Again SHell',
154+
' Bash is an sh-compatible command language interpreter that executes',
155+
' commands read from the standard input or from a file. Bash also',
156+
' incorporates useful features from the Korn and C shells (ksh and csh).',
157+
' .',
158+
' Bash is ultimately intended to be a conformant implementation of the',
159+
' IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2).',
160+
' .',
161+
' The Programmable Completion Code, by Ian Macdonald, is now found in',
162+
' the bash-completion package.' + os.linesep
163+
]),
166164
'homepage': 'http://tiswww.case.edu/php/chet/bash/bashtop.html',
167165
'maintainer': 'Ubuntu Developers '
168166

0 commit comments

Comments
 (0)