コード例 #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
ファイル: environ_test.py プロジェクト: HowardMei/saltstack
    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
ファイル: test_environ.py プロジェクト: crimv42/saltstack
    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"))