Exemplo n.º 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"))
Exemplo n.º 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'))
Exemplo n.º 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'))
Exemplo n.º 4
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"))