예제 #1
0
    def test_has_value(self):
        """
        Determine whether the key exists in the current salt process
        environment dictionary. Optionally compare the current value
        of the environment against the supplied value string.
        """
        mock_environ = {}
        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.has_value(True))

            os.environ["salty"] = "yes"
            self.assertTrue(environ.has_value("salty", "yes"))

            os.environ["too_salty"] = "no"
            self.assertFalse(environ.has_value("too_salty", "yes"))

            self.assertFalse(environ.has_value("key", "value"))

            os.environ["key"] = "value"
            self.assertTrue(environ.has_value("key"))
예제 #2
0
    def test_has_value(self):
        '''
        Determine whether the key exists in the current salt process
        environment dictionary. Optionally compare the current value
        of the environment against the supplied value string.
        '''
        mock_environ = {}
        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.has_value(True))

            os.environ['salty'] = 'yes'
            self.assertTrue(environ.has_value('salty', 'yes'))

            os.environ['too_salty'] = 'no'
            self.assertFalse(environ.has_value('too_salty', 'yes'))

            self.assertFalse(environ.has_value('key', 'value'))

            os.environ['key'] = 'value'
            self.assertTrue(environ.has_value('key'))
예제 #3
0
    def test_has_value(self):
        '''
        Determine whether the key exists in the current salt process
        environment dictionary. Optionally compare the current value
        of the environment against the supplied value string.
        '''
        mock_environ = {}
        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.has_value(True))

            os.environ['salty'] = 'yes'
            self.assertTrue(environ.has_value('salty', 'yes'))

            os.environ['too_salty'] = 'no'
            self.assertFalse(environ.has_value('too_salty', 'yes'))

            self.assertFalse(environ.has_value('key', 'value'))

            os.environ['key'] = 'value'
            self.assertTrue(environ.has_value('key'))
예제 #4
0
파일: environ_test.py 프로젝트: DaveQB/salt
    def test_has_value(self):
        """
        Determine whether the key exists in the current salt process
        environment dictionary. Optionally compare the current value
        of the environment against the supplied value string.
        """
        mock_environ = {}
        with patch.dict(os.environ, mock_environ):
            self.assertFalse(environ.has_value(True))

            os.environ["salty"] = "yes"
            self.assertTrue(environ.has_value("salty", "yes"))

            os.environ["too_salty"] = "no"
            self.assertFalse(environ.has_value("too_salty", "yes"))

            self.assertFalse(environ.has_value("key", "value"))

            os.environ["key"] = "value"
            self.assertTrue(environ.has_value("key"))