def test_maxdepth_string(self, session): tag_name = 'my-centos-7-child' tag_id = 2 check_mode = False inheritance = [ { 'parent': 'my-centos-7-parent', 'priority': 0, 'maxdepth': '30' }, ] koji_tag.ensure_inheritance(session, tag_name, tag_id, check_mode, inheritance) result = session.getInheritanceData('my-centos-7-child') expected = [{ 'child_id': 2, 'intransitive': False, 'maxdepth': 30, 'name': 'my-centos-7-parent', 'noconfig': False, 'parent_id': 1, 'pkg_filter': '', 'priority': 0 }] assert result == expected
def test_parent_does_not_exist(self, session): tag_name = 'my-centos-7-child' tag_id = 2 check_mode = False inheritance = [ {'parent': 'my-nonexistant-parent', 'priority': 0}, ] with pytest.raises(ValueError): koji_tag.ensure_inheritance(session, tag_name, tag_id, check_mode, inheritance)
def test_parent_does_not_exist_check_mode(self, session): tag_name = 'my-centos-7-child' tag_id = 2 check_mode = True inheritance = [ {'parent': 'my-nonexistant-parent', 'priority': 0}, ] result = koji_tag.ensure_inheritance(session, tag_name, tag_id, check_mode, inheritance) expected = { 'changed': True, 'stdout_lines': ["parent tag 'my-nonexistant-parent' not found", 'current inheritance:', 'new inheritance:', ' 0 .... my-nonexistant-parent']} assert result == expected