mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #49710 from rallytime/merge-2018.3
[2018.3] Merge forward from 2017.7 to 2018.3
This commit is contained in:
commit
936cae5017
@ -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'},
|
||||
@ -181,6 +182,9 @@ TEST_SUITES = {
|
||||
'path': 'integration/scheduler'},
|
||||
}
|
||||
|
||||
TEST_SUITES = collections.OrderedDict(sorted(TEST_SUITES_UNORDERED.items(),
|
||||
key=lambda x: x[0]))
|
||||
|
||||
|
||||
class SaltTestsuiteParser(SaltCoverageTestingParser):
|
||||
support_docker_execution = True
|
||||
|
@ -788,28 +788,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.files.fopen', mock_open()):
|
||||
|
Loading…
Reference in New Issue
Block a user