Esempio n. 1
0
    def test_sls(self, get_sls_opts, get_file_client, SSHHighState,
                 _create_and_execute_salt_state):
        '''
        Test execution of Salt states in chroot.
        '''
        SSHHighState.return_value = SSHHighState
        SSHHighState.render_highstate.return_value = (None, [])
        SSHHighState.state.reconcile_extend.return_value = (None, [])
        SSHHighState.state.requisite_in.return_value = (None, [])
        SSHHighState.state.verify_high.return_value = []

        _create_and_execute_salt_state.return_value = 'result'
        opts_mock = {
            'hash_type': 'md5',
        }
        get_sls_opts.return_value = opts_mock
        with patch.dict(chroot.__opts__, opts_mock):
            self.assertEqual(chroot.sls('/chroot', 'module'), 'result')
            _create_and_execute_salt_state.assert_called_once()
Esempio n. 2
0
    def test_sls(
        self,
        get_sls_opts,
        get_file_client,
        SSHHighState,
        _create_and_execute_salt_state,
    ):
        """
        Test execution of Salt states in chroot.
        """
        SSHHighState.return_value = SSHHighState
        SSHHighState.render_highstate.return_value = (None, [])
        SSHHighState.state.reconcile_extend.return_value = (None, [])
        SSHHighState.state.requisite_in.return_value = (None, [])
        SSHHighState.state.verify_high.return_value = []

        _create_and_execute_salt_state.return_value = "result"
        opts_mock = {
            "hash_type": "md5",
        }
        get_sls_opts.return_value = opts_mock
        with patch.dict(chroot.__opts__, opts_mock):
            self.assertEqual(chroot.sls("/chroot", "module"), "result")
            _create_and_execute_salt_state.assert_called_once()