mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Removing match tests, functionality does not exist in 2019.2.1
This commit is contained in:
parent
4af95e49a1
commit
09f6fed3ec
@ -18,7 +18,6 @@ from tests.support.mock import (
|
||||
)
|
||||
|
||||
# Import Salt Libs
|
||||
from salt.exceptions import SaltException
|
||||
import salt.modules.match as match
|
||||
import salt.matchers.compound_match as compound_match
|
||||
import salt.matchers.glob_match as glob_match
|
||||
@ -78,130 +77,6 @@ class MatchTestCase(TestCase, LoaderModuleMockMixin):
|
||||
|
||||
self.assertDictEqual(match.filter_by(lookup), result)
|
||||
|
||||
def test_filter_by_merge(self):
|
||||
'''
|
||||
Tests if filter_by returns a dictionary merged with another dictionary.
|
||||
'''
|
||||
lookup = {
|
||||
'foo*': {
|
||||
'key1': 'fooval1', 'key2': 'fooval2'
|
||||
},
|
||||
'bar*': {
|
||||
'key1': 'barval1', 'key2': 'barval2'
|
||||
}
|
||||
}
|
||||
mdict = {'key1': 'mergeval1'}
|
||||
result = {'key1': 'mergeval1', 'key2': 'barval2'}
|
||||
|
||||
self.assertDictEqual(match.filter_by(lookup, merge=mdict), result)
|
||||
|
||||
def test_filter_by_merge_lists_rep(self):
|
||||
'''
|
||||
Tests if filter_by merges list values by replacing the original list
|
||||
values with the merged list values.
|
||||
'''
|
||||
lookup = {
|
||||
'foo*': {
|
||||
'list_key': []
|
||||
},
|
||||
'bar*': {
|
||||
'list_key': [
|
||||
'val1',
|
||||
'val2'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
mdict = {
|
||||
'list_key': [
|
||||
'val3',
|
||||
'val4'
|
||||
]
|
||||
}
|
||||
|
||||
# list replacement specified by the merge_lists=False option
|
||||
result = {
|
||||
'list_key': [
|
||||
'val3',
|
||||
'val4'
|
||||
]
|
||||
}
|
||||
|
||||
self.assertDictEqual(match.filter_by(lookup, merge=mdict, merge_lists=False), result)
|
||||
|
||||
def test_filter_by_merge_lists_agg(self):
|
||||
'''
|
||||
Tests if filter_by merges list values by aggregating them.
|
||||
'''
|
||||
lookup = {
|
||||
'foo*': {
|
||||
'list_key': []
|
||||
},
|
||||
'bar*': {
|
||||
'list_key': [
|
||||
'val1',
|
||||
'val2'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
mdict = {
|
||||
'list_key': [
|
||||
'val3',
|
||||
'val4'
|
||||
]
|
||||
}
|
||||
|
||||
# list aggregation specified by the merge_lists=True option
|
||||
result = {
|
||||
'list_key': [
|
||||
'val1',
|
||||
'val2',
|
||||
'val3',
|
||||
'val4'
|
||||
]
|
||||
}
|
||||
|
||||
self.assertDictEqual(match.filter_by(lookup, merge=mdict, merge_lists=True), result)
|
||||
|
||||
def test_filter_by_merge_with_none(self):
|
||||
'''
|
||||
Tests if filter_by merges a None object with a merge dictionary.
|
||||
'''
|
||||
lookup = {
|
||||
'foo*': {
|
||||
'key1': 'fooval1', 'key2': 'fooval2'
|
||||
},
|
||||
'bar*': None
|
||||
}
|
||||
|
||||
# mdict should also be the returned dictionary
|
||||
# since a merge is done with None
|
||||
mdict = {'key1': 'mergeval1'}
|
||||
|
||||
self.assertDictEqual(match.filter_by(lookup, merge=mdict), mdict)
|
||||
|
||||
def test_filter_by_merge_fail(self):
|
||||
'''
|
||||
Tests for an exception if a merge is done without a dictionary.
|
||||
'''
|
||||
lookup = {
|
||||
'foo*': {
|
||||
'key1': 'fooval1', 'key2': 'fooval2'
|
||||
},
|
||||
'bar*': {
|
||||
'key1': 'barval1', 'key2': 'barval2'
|
||||
}
|
||||
}
|
||||
mdict = 'notadict'
|
||||
|
||||
self.assertRaises(
|
||||
SaltException,
|
||||
match.filter_by,
|
||||
lookup,
|
||||
merge=mdict
|
||||
)
|
||||
|
||||
def test_watch_for_opts_mismatch_glob_match(self):
|
||||
'''
|
||||
Tests for situations where the glob matcher might reference __opts__ directly
|
||||
|
Loading…
Reference in New Issue
Block a user