Ejemplo n.º 1
0
 def test_absolute(self):
     l = limits.Limits(None,
                       {"absolute": {
                           "name1": "value1",
                           "name2": "value2"
                       }})
     l1 = limits.AbsoluteLimit("name1", "value1")
     l2 = limits.AbsoluteLimit("name2", "value2")
     for item in l.absolute:
         self.assertIn(item, [l1, l2])
Ejemplo n.º 2
0
    def test_get(self):
        api = mock.Mock()
        api.client.get.return_value = (None, {
            "limits": {
                "absolute": {
                    "name1": "value1",
                }
            },
            "no-limits": {
                "absolute": {
                    "name2": "value2",
                }
            }
        })
        l1 = limits.AbsoluteLimit("name1", "value1")
        limitsManager = limits.LimitsManager(api)

        lim = limitsManager.get()

        self.assertIsInstance(lim, limits.Limits)
        for l in lim.absolute:
            self.assertEqual(l1, l)
Ejemplo n.º 3
0
 def test_repr(self):
     l1 = limits.AbsoluteLimit("name1", "value1")
     self.assertEqual("<AbsoluteLimit: name=name1>", repr(l1))
Ejemplo n.º 4
0
 def test_not_equal_names(self):
     l1 = limits.AbsoluteLimit("name1", "value1")
     l2 = limits.AbsoluteLimit("name2", "value1")
     self.assertNotEqual(l1, l2)