mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2017.7' into fix_49675_2017.7
This commit is contained in:
commit
912722253c
2 changed files with 16 additions and 16 deletions
|
@ -11,6 +11,7 @@ import os
|
|||
import sys
|
||||
import time
|
||||
import warnings
|
||||
import collections
|
||||
|
||||
TESTS_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
|
||||
if os.name == 'nt':
|
||||
|
@ -97,7 +98,7 @@ MAX_OPEN_FILES = {
|
|||
|
||||
# Combine info from command line options and test suite directories. A test
|
||||
# suite is a python package of test modules relative to the tests directory.
|
||||
TEST_SUITES = {
|
||||
TEST_SUITES_UNORDERED = {
|
||||
'unit':
|
||||
{'display_name': 'Unit',
|
||||
'path': 'unit'},
|
||||
|
@ -172,6 +173,9 @@ TEST_SUITES = {
|
|||
'path': 'integration/externalapi'},
|
||||
}
|
||||
|
||||
TEST_SUITES = collections.OrderedDict(sorted(TEST_SUITES_UNORDERED.items(),
|
||||
key=lambda x: x[0]))
|
||||
|
||||
|
||||
class SaltTestsuiteParser(SaltCoverageTestingParser):
|
||||
support_docker_execution = True
|
||||
|
|
|
@ -781,28 +781,24 @@ class StateTestCase(TestCase, LoaderModuleMockMixin):
|
|||
Test to clear out the state execution request without executing it
|
||||
'''
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os.path, 'join', mock):
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(salt.payload, 'Serial', mock):
|
||||
mock = MagicMock(side_effect=[False, True, True])
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
self.assertTrue(state.clear_request("A"))
|
||||
with patch.object(salt.payload, 'Serial', mock):
|
||||
mock = MagicMock(side_effect=[False, True, True])
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
self.assertTrue(state.clear_request("A"))
|
||||
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os, 'remove', mock):
|
||||
self.assertTrue(state.clear_request())
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os, 'remove', mock):
|
||||
self.assertTrue(state.clear_request())
|
||||
|
||||
mock = MagicMock(return_value={})
|
||||
with patch.object(state, 'check_request', mock):
|
||||
self.assertFalse(state.clear_request("A"))
|
||||
mock = MagicMock(return_value={})
|
||||
with patch.object(state, 'check_request', mock):
|
||||
self.assertFalse(state.clear_request("A"))
|
||||
|
||||
def test_check_request(self):
|
||||
'''
|
||||
Test to return the state request information
|
||||
'''
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os.path, 'join', mock), \
|
||||
patch('salt.modules.state.salt.payload', MockSerial):
|
||||
with patch('salt.modules.state.salt.payload', MockSerial):
|
||||
mock = MagicMock(side_effect=[True, True, False])
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
with patch('salt.utils.fopen', mock_open()):
|
||||
|
|
Loading…
Add table
Reference in a new issue