Ejemplo n.º 1
0
 def test_nested(self):
     """
     Retrieve a value from a nested level of the dictionary
     """
     plain = {"foo": {"bar": "baz"}}
     with patch("salt.sdb.yaml._get_values", MagicMock(return_value=plain)):
         self.assertEqual(sdb.get("foo:bar"), "baz")
Ejemplo n.º 2
0
 def test_plaintext(self):
     """
     Retrieve a value from the top level of the dictionary
     """
     plain = {"foo": "bar"}
     with patch("salt.sdb.yaml._get_values", MagicMock(return_value=plain)):
         self.assertEqual(sdb.get("foo"), "bar")
Ejemplo n.º 3
0
 def test_nested(self):
     '''
     Retrieve a value from a nested level of the dictionary
     '''
     plain = {'foo': {'bar': 'baz'}}
     with patch('salt.sdb.yaml._get_values', MagicMock(return_value=plain)):
         self.assertEqual(sdb.get('foo:bar'), 'baz')
Ejemplo n.º 4
0
 def test_plaintext(self):
     '''
     Retrieve a value from the top level of the dictionary
     '''
     plain = {'foo': 'bar'}
     with patch('salt.sdb.yaml._get_values', MagicMock(return_value=plain)):
         self.assertEqual(sdb.get('foo'), 'bar')
Ejemplo n.º 5
0
 def test_encrypted(self):
     '''
     Assume the content is plaintext if GPG is not configured
     '''
     plain = {'foo': 'bar'}
     with patch('salt.sdb.yaml._decrypt', MagicMock(return_value=plain)):
         with patch('salt.sdb.yaml._get_values', MagicMock(return_value=None)):
             self.assertEqual(sdb.get('foo', profile={'gpg': True}), 'bar')
Ejemplo n.º 6
0
 def test_encrypted(self):
     """
     Assume the content is plaintext if GPG is not configured
     """
     plain = {"foo": "bar"}
     with patch("salt.sdb.yaml._decrypt", MagicMock(return_value=plain)):
         with patch("salt.sdb.yaml._get_values",
                    MagicMock(return_value=None)):
             self.assertEqual(sdb.get("foo", profile={"gpg": True}), "bar")