예제 #1
0
    def test_setenv(self):
        """
        Set multiple salt process environment variables from a dict.
        Returns a dict.
        """
        mock_environ = {"KEY": "value"}
        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.setenv("environ"))

        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.setenv({"A": True}, False, True, False))

        with patch.dict(os.environ, mock_environ):
            mock_setval = MagicMock(return_value=None)
            with patch.object(environ, "setval", mock_setval):
                self.assertEqual(environ.setenv({}, False, True, False)["KEY"], None)
예제 #2
0
파일: environ_test.py 프로젝트: DaveQB/salt
    def test_setenv(self):
        """
        Set multiple salt process environment variables from a dict.
        Returns a dict.
        """
        mock_environ = {"key": "value"}
        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.setenv("environ"))

        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.setenv({"A": True}, False, True, False))

        with patch.dict(os.environ, mock_environ):
            mock_setval = MagicMock(return_value=None)
            with patch.object(environ, "setval", mock_setval):
                self.assertEqual(environ.setenv({}, False, True, False)["key"], None)
예제 #3
0
    def test_setenv(self):
        '''
        Set multiple salt process environment variables from a dict.
        Returns a dict.
        '''
        mock_environ = {'KEY': 'value'}
        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.setenv('environ'))

        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.setenv({'A': True}, False, True, False))

        with patch.dict(os.environ, mock_environ):
            mock_setval = MagicMock(return_value=None)
            with patch.object(environ, 'setval', mock_setval):
                self.assertEqual(
                    environ.setenv({}, False, True, False)['KEY'], None)
예제 #4
0
    def test_setenv(self):
        '''
        Set multiple salt process environment variables from a dict.
        Returns a dict.
        '''
        mock_environ = {'key': 'value'}
        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.setenv('environ'))

        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.setenv({'A': True},
                                            False,
                                            True,
                                            False))

        with patch.dict(os.environ, mock_environ):
            mock_setval = MagicMock(return_value=None)
            with patch.object(environ, 'setval', mock_setval):
                self.assertEqual(environ.setenv({}, False, True, False)['key'],
                                 None)