def test_parse_os_release(self): data = ['NAME="Ubuntu"', 'VERSION="14.04.4 LTS, Trusty Tahr"', 'ID=ubuntu', 'ID_LIKE=debian', 'PRETTY_NAME="Ubuntu 14.04.4 LTS"', 'VERSION_ID="14.04"', 'HOME_URL="http://www.ubuntu.com/"', 'SUPPORT_URL="http://help.ubuntu.com/"', 'BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"' ] result = parse_os_release(data) self.assertEqual(result['os'], 'ubuntu') self.assertEqual(result['version'], '14.04')
def test_suse_parse_os_release(self): data = ['NAME="SLES"', 'VERSION="12"', 'VERSION_ID="12"', 'PRETTY_NAME="SUSE Linux Enterprise Server 12"', 'ID="sles"', 'ANSI_COLOR="0;32"' ] result = parse_os_release(data) self.assertEqual(result['os'], 'sles') self.assertEqual(result['version'], '12')
def test_alpine_parse_os_release(self): data = ['NAME="Alpine Linux"', 'ID=alpine', 'VERSION_ID=3.4.0', 'PRETTY_NAME="Alpine Linux v3.4"', 'HOME_URL="http://alpinelinux.org"', 'BUG_REPORT_URL="http://bugs.alpinelinux.org"' ] result = parse_os_release(data) self.assertEqual(result['os'], 'alpine') self.assertEqual(result['version'], '3.4.0')