From 4c9dd39118fd1b2bc6e25ba648cd4904e6f43cd1 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Fri, 12 May 2017 15:51:04 +0200 Subject: [PATCH] Add UT to match multiple asterisks --- tests/unit/modules/test_zypper.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/unit/modules/test_zypper.py b/tests/unit/modules/test_zypper.py index 412eee9528..af178f15a0 100644 --- a/tests/unit/modules/test_zypper.py +++ b/tests/unit/modules/test_zypper.py @@ -6,6 +6,7 @@ # Import Python Libs from __future__ import absolute_import import os +from xml.dom import minidom # Import Salt Testing Libs 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)) 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 = """ + + + + + """ - solvables = minidom.parseString(xmldoc) + _zpr = MagicMock() - _zpr.nolock.xml.call = MagicMock(return_value=solvables) - wildcard = zypper.Wildcard(_zpr) + _zpr.nolock.xml.call = MagicMock(return_value=minidom.parseString(xmldoc)) + assert zypper.Wildcard(_zpr)('libzypp', '16.2.*-2*') == [u'16.2.5-25.1', u'16.2.6-27.9.1']