def test_simple_map(anchore_db): init_distro_mappings() found = DistroMapping() found.from_distro = 'centos' found.to_distro = 'centos' found.flavor = 'RHEL' mapper = VersionPreservingDistroMapper('centos', '7', None, found) logger.info('Mapped centos to: {}'.format(mapper.mapping)) assert mapper.mapping == [ DistroTuple(distro='centos', version='7', flavor='RHEL') ] found.from_distro = 'fedora' found.to_distro = 'centos' found.flavor = 'RHEL' mapper = VersionPreservingDistroMapper('fedora', '27', 'centos', found) logger.info('Mapped fedora to: {}'.format(mapper.mapping)) assert mapper.mapping == [ DistroTuple(distro='centos', version='27', flavor='RHEL') ] mapper = VersionPreservingDistroMapper('fedora', '27', 'centos', None) logger.info('Mapped fedora to: {} on empty input'.format(mapper.mapping)) assert mapper.mapping == [ DistroTuple(distro='fedora', version='27', flavor='RHEL') ]
def test_simple_map(anchore_db): init_distro_mappings() found = DistroMapping() found.from_distro = "centos" found.to_distro = "centos" found.flavor = "RHEL" mapper = VersionPreservingDistroMapper("centos", "7", None, found) logger.info("Mapped centos to: {}".format(mapper.mapping)) assert mapper.mapping == [ DistroTuple(distro="centos", version="7", flavor="RHEL") ] found.from_distro = "fedora" found.to_distro = "centos" found.flavor = "RHEL" mapper = VersionPreservingDistroMapper("fedora", "27", "centos", found) logger.info("Mapped fedora to: {}".format(mapper.mapping)) assert mapper.mapping == [ DistroTuple(distro="centos", version="27", flavor="RHEL") ] mapper = VersionPreservingDistroMapper("fedora", "27", "centos", None) logger.info("Mapped fedora to: {} on empty input".format(mapper.mapping)) assert mapper.mapping == [ DistroTuple(distro="fedora", version="27", flavor="RHEL") ]
def test_simple_map(self): found = DistroMapping() found.from_distro = 'centos' found.to_distro = 'centos' found.flavor = 'RHEL' mapper = VersionPreservingDistroMapper('centos', '7', None, found) print(('Mapped centos to: {}'.format(mapper.mapping))) found.from_distro = 'fedora' found.to_distro = 'centos' found.flavor = 'RHEL' mapper = VersionPreservingDistroMapper('fedora', '27', 'centos', found) print(('Mapped fedora to: {}'.format(mapper.mapping))) mapper = VersionPreservingDistroMapper('fedora', '27', 'centos', None) print(('Mapped fedora to: {} on empty input'.format(mapper.mapping)))