Esempio n. 1
0
def test_equals():
    with patch.dict(
        grainsmod.__grains__,
        OrderedDict(
            [
                ("a", "aval"),
                (
                    "b",
                    OrderedDict(
                        [
                            ("z", "zval"),
                            (
                                "l1",
                                ["l21", "l22", OrderedDict([("l23", "l23val")])],
                            ),
                        ]
                    ),
                ),
                ("c", 8),
            ]
        ),
    ):
        res = grainsmod.equals("a", "aval")
        assert type(res) == bool
        assert res
        res = grainsmod.equals("b:z", "zval")
        assert res
        res = grainsmod.equals("b:z", "aval")
        assert not res
Esempio n. 2
0
 def test_equals(self):
     with patch.dict(
             grainsmod.__grains__,
             OrderedDict([
                 ("a", "aval"),
                 (
                     "b",
                     OrderedDict([
                         ("z", "zval"),
                         (
                             "l1",
                             [
                                 "l21", "l22",
                                 OrderedDict([("l23", "l23val")])
                             ],
                         ),
                     ]),
                 ),
                 ("c", 8),
             ]),
     ):
         res = grainsmod.equals("a", "aval")
         self.assertEqual(type(res), bool)
         self.assertTrue(res)
         res = grainsmod.equals("b:z", "zval")
         self.assertTrue(res)
         res = grainsmod.equals("b:z", "aval")
         self.assertFalse(res)
Esempio n. 3
0
 def test_equals(self):
     grainsmod.__grains__ = OrderedDict([
         ('a', 'aval'),
         ('b',
          OrderedDict([('z', 'zval'),
                       ('l1',
                        ['l21', 'l22',
                         OrderedDict([('l23', 'l23val')])])])), ('c', 8)
     ])
     res = grainsmod.equals('a', 'aval')
     self.assertEqual(type(res), bool)
     self.assertTrue(res)
     res = grainsmod.equals('b:z', 'zval')
     self.assertTrue(res)
     res = grainsmod.equals('b:z', 'aval')
     self.assertFalse(res)