def test_equivalent_definition_and_eq(self): """ If every attribute is the same, both :func:`CLBDescription.__eq__` and :func:`CLBDescription.equivalent_definition` will return `True`. """ desc1 = CLBDescription(lb_id='12345', port=80) desc2 = CLBDescription(lb_id='12345', port=80) self.assertTrue(desc1.equivalent_definition(desc2)) self.assertEquals(desc1, desc2)
def test_equivalent_definition_and_eq(self): """ If every attribute is the same, both :func:`CLBDescription.__eq__` and :func:`CLBDescription.equivalent_definition` will return `True`. """ desc1 = CLBDescription(lb_id='12345', port=80) desc2 = CLBDescription(lb_id='12345', port=80) self.assertTrue(desc1.equivalent_definition(desc2)) self.assertEquals(desc1, desc2)
def test_neither_equivalent_definition_or_eq(self): """ If ``lb_id`` and ``port`` are different, even if everything else are the same, neither :func:`CLBDescription.equivalent_definition` nor :func:`CLBDescription.__eq__` will return `True`. """ desc1 = CLBDescription(lb_id='12345', port=80) desc2 = CLBDescription(lb_id='12345', port=8080) self.assertFalse(desc1.equivalent_definition(desc2)) self.assertNotEqual(desc1, desc2)
def test_neither_equivalent_definition_or_eq(self): """ If ``lb_id`` and ``port`` are different, even if everything else are the same, neither :func:`CLBDescription.equivalent_definition` nor :func:`CLBDescription.__eq__` will return `True`. """ desc1 = CLBDescription(lb_id='12345', port=80) desc2 = CLBDescription(lb_id='12345', port=8080) self.assertFalse(desc1.equivalent_definition(desc2)) self.assertNotEqual(desc1, desc2)
def test_only_eq_and_equivalent_definition_to_other_CLBDescriptions(self): """ :func:`CLBDescriptionTest.__eq__` and :func:`CLBDescriptionTest.equivalent_definition` return false if compared to a non-:class:`CLBDescription` :class:`ILBDescription` provider. """ desc = CLBDescription(lb_id='12345', port=80) fake = DummyLBDescription() self.assertNotEqual(desc, fake) self.assertFalse(desc.equivalent_definition(fake))
def test_only_eq_and_equivalent_definition_to_other_CLBDescriptions(self): """ :func:`CLBDescriptionTest.__eq__` and :func:`CLBDescriptionTest.equivalent_definition` return false if compared to a non-:class:`CLBDescription` :class:`ILBDescription` provider. """ desc = CLBDescription(lb_id='12345', port=80) fake = DummyLBDescription() self.assertNotEqual(desc, fake) self.assertFalse(desc.equivalent_definition(fake))
def test_equivalent_definition_but_not_eq(self): """ Even if weight, etc. are different, so long as the ``lb_id`` and ``port`` are identical, :func:`CLBDescription.equivalent_definition` will return `True`. :func:`CLBDescription.__eq__` will not, however. """ desc1 = CLBDescription(lb_id='12345', port=80) desc2 = CLBDescription(lb_id='12345', port=80, weight=2, condition=CLBNodeCondition.DISABLED, type=CLBNodeType.SECONDARY) self.assertTrue(desc1.equivalent_definition(desc2)) self.assertNotEqual(desc1, desc2)
def test_equivalent_definition_but_not_eq(self): """ Even if weight, etc. are different, so long as the ``lb_id`` and ``port`` are identical, :func:`CLBDescription.equivalent_definition` will return `True`. :func:`CLBDescription.__eq__` will not, however. """ desc1 = CLBDescription(lb_id='12345', port=80) desc2 = CLBDescription(lb_id='12345', port=80, weight=2, condition=CLBNodeCondition.DISABLED, type=CLBNodeType.SECONDARY) self.assertTrue(desc1.equivalent_definition(desc2)) self.assertNotEqual(desc1, desc2)