Beispiel #1
0
 def test_name_lookup_is_case_insensitive(self):
   assert model.Distro.UBUNTU == model.distro_for("ubuntu")
   assert model.Distro.UBUNTU == model.distro_for("Ubuntu")
   assert model.Distro.OPENSUSE == model.distro_for("opensuse")
   assert model.Distro.OPENSUSE == model.distro_for("openSUSE")
   assert model.Distro.RHEL == model.distro_for("rhel")
   assert model.Distro.RHEL == model.distro_for("RHEL")
   assert model.Distro.CENTOS == model.distro_for("CentOS")
   assert model.Distro.CENTOS == model.distro_for("centos")
Beispiel #2
0
def test_yaml_encoded_cases(fpath):
    with open(fpath) as stream:
        loaded_yaml = yaml.safe_load(stream)
        assert 'files' in loaded_yaml
        assert 'expected' in loaded_yaml
        fs = filesystems.DictBackedFilesystem(loaded_yaml['files'])
        expected = model.OperatingSystem(
            model.distro_for(loaded_yaml['expected']['distro']),
            model.Version(loaded_yaml['expected']['major'],
                          loaded_yaml['expected']['minor']))

    inspector = inspection._linux_inspector(fs)
    actual = inspector.inspect()
    assert expected == actual
Beispiel #3
0
def test_yaml_encoded_cases(fpath):
    with open(fpath) as stream:
        loaded_yaml = yaml.safe_load(stream)
        assert 'files' in loaded_yaml
        assert 'expected' in loaded_yaml
        fs = filesystems.DictBackedFilesystem(loaded_yaml['files'])
        expected = inspect_pb2.OsRelease(
            major_version=none_to_empty(loaded_yaml['expected'].get('major')),
            minor_version=none_to_empty(loaded_yaml['expected'].get('minor')),
            distro_id=(model.distro_for(loaded_yaml['expected']['distro'])),
        )
        inspector = inspection._linux_inspector(fs)
        actual = inspector.inspect()
        if expected.minor_version == "None":
            assert False
        assert expected == actual
Beispiel #4
0
 def _is_windows(self) -> bool:
   inspected = self._g.inspect_get_distro(self._root)
   return model.distro_for(inspected) == model.Distro.WINDOWS
Beispiel #5
0
 def test_name_lookup_returns_None_when_no_match(self):
   assert model.distro_for("not-a-distro-name") is None
   assert model.distro_for("") is None
Beispiel #6
0
 def test_name_lookup_supports_hyphens(self):
   assert inspect_pb2.Distro.SLES_SAP == model.distro_for("sles-sap")