mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Add UT to match multiple asterisks
This commit is contained in:
parent
8839f7219b
commit
4c9dd39118
@ -6,6 +6,7 @@
|
|||||||
# Import Python Libs
|
# Import Python Libs
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import os
|
import os
|
||||||
|
from xml.dom import minidom
|
||||||
|
|
||||||
# Import Salt Testing Libs
|
# Import Salt Testing Libs
|
||||||
from tests.support.mixins import LoaderModuleMockMixin
|
from tests.support.mixins import LoaderModuleMockMixin
|
||||||
@ -935,8 +936,19 @@ Repository 'DUMMY' not found by its alias, number, or URI.
|
|||||||
_zpr.nolock.xml.call = MagicMock(return_value=minidom.parseString(xmldoc))
|
_zpr.nolock.xml.call = MagicMock(return_value=minidom.parseString(xmldoc))
|
||||||
assert zypper.Wildcard(_zpr)('libzypp', '*') == [u'16.2.4-19.5', u'16.3.2-25.1', u'16.5.2-27.9.1']
|
assert zypper.Wildcard(_zpr)('libzypp', '*') == [u'16.2.4-19.5', u'16.3.2-25.1', u'16.5.2-27.9.1']
|
||||||
|
|
||||||
|
def test_wildcard_to_query_multiple_asterisk(self):
|
||||||
|
'''
|
||||||
|
Test wildcard to query match multiple asterisk
|
||||||
|
:return:
|
||||||
|
'''
|
||||||
|
xmldoc = """<?xml version='1.0'?><stream>
|
||||||
|
<search-result version="0.0"><solvable-list>
|
||||||
|
<solvable status="installed" name="libzypp" kind="package" edition="16.2.4-19.5" arch="x86_64" repository="foo"/>
|
||||||
|
<solvable status="other-version" name="libzypp" kind="package" edition="16.2.5-25.1" arch="x86_64" repository="foo"/>
|
||||||
|
<solvable status="other-version" name="libzypp" kind="package" edition="16.2.6-27.9.1" arch="x86_64" repository="foo"/>
|
||||||
|
</solvable-list></search-result></stream>
|
||||||
"""
|
"""
|
||||||
solvables = minidom.parseString(xmldoc)
|
|
||||||
_zpr = MagicMock()
|
_zpr = MagicMock()
|
||||||
_zpr.nolock.xml.call = MagicMock(return_value=solvables)
|
_zpr.nolock.xml.call = MagicMock(return_value=minidom.parseString(xmldoc))
|
||||||
wildcard = zypper.Wildcard(_zpr)
|
assert zypper.Wildcard(_zpr)('libzypp', '16.2.*-2*') == [u'16.2.5-25.1', u'16.2.6-27.9.1']
|
||||||
|
Loading…
Reference in New Issue
Block a user