Beispiel #1
0
def _validate_move_ban_clear_analyzer(resource_element):
    resource_is_bundle = False
    resource_is_clone = False
    resource_is_in_clone = False
    resource_is_promotable_clone = False
    resource_is_in_promotable_clone = False
    promotable_clone_element = None

    if is_bundle(resource_element):
        resource_is_bundle = True
    elif is_any_clone(resource_element):
        resource_is_clone = True
        if is_master(resource_element) or is_promotable_clone(resource_element):
            resource_is_promotable_clone = True
            promotable_clone_element = resource_element
    elif get_parent_any_clone(resource_element) is not None:
        parent_clone = get_parent_any_clone(resource_element)
        resource_is_in_clone = True
        if is_master(parent_clone) or is_promotable_clone(parent_clone):
            resource_is_in_promotable_clone = True
            promotable_clone_element = parent_clone
    return _MoveBanClearAnalysis(
        resource_is_bundle,
        resource_is_clone,
        resource_is_in_clone,
        resource_is_promotable_clone,
        resource_is_in_promotable_clone,
        (
            promotable_clone_element.get("id")
            if promotable_clone_element is not None
            else None
        )
    )
Beispiel #2
0
 def test_is_master(self):
     self.assertTrue(clone.is_master(etree.fromstring("<master/>")))
     self.assertFalse(clone.is_master(etree.fromstring("<clone/>")))
     self.assertFalse(clone.is_master(etree.fromstring("<group/>")))
Beispiel #3
0
 def test_is_master(self):
     self.assertTrue(clone.is_master(etree.fromstring("<master/>")))
     self.assertFalse(clone.is_master(etree.fromstring("<clone/>")))
     self.assertFalse(clone.is_master(etree.fromstring("<group/>")))