def test_multiple_key(self): self._dict["prefix"] = {"foo": {"bar": "baz"}} w = NamespacedDictWrapper(self._dict, ("prefix", "foo")) self.assertEqual(w["bar"], "baz")
def test_json_dumps_multiple_key(self): self._dict["prefix"] = {"foo": {"bar": "baz"}} w = NamespacedDictWrapper(self._dict, ("prefix", "foo")) self.assertEqual(salt.utils.json.dumps(w), '{"bar": "baz"}')
def test_single_key(self): self._dict["prefix"] = {"foo": "bar"} w = NamespacedDictWrapper(self._dict, "prefix") self.assertEqual(w["foo"], "bar")
def test_json_dumps_multiple_key(self): self._dict['prefix'] = {'foo': {'bar': 'baz'}} w = NamespacedDictWrapper(self._dict, ('prefix', 'foo')) self.assertEqual(salt.utils.json.dumps(w), '{"bar": "baz"}')
def test_json_dumps_single_key(self): self._dict['prefix'] = {'foo': {'bar': 'baz'}} w = NamespacedDictWrapper(self._dict, 'prefix') self.assertEqual(salt.utils.json.dumps(w), '{"foo": {"bar": "baz"}}')
def test_multiple_key(self): self._dict['prefix'] = {'foo': {'bar': 'baz'}} w = NamespacedDictWrapper(self._dict, ('prefix', 'foo')) self.assertEqual(w['bar'], 'baz')
def test_single_key(self): self._dict['prefix'] = {'foo': 'bar'} w = NamespacedDictWrapper(self._dict, 'prefix') self.assertEqual(w['foo'], 'bar')