1
from landscape.tests.helpers import LandscapeTest
3
from landscape.lib.lsb_release import parse_lsb_release
6
class LsbReleaseTest(LandscapeTest):
8
def test_parse_lsb_release(self):
10
L{parse_lsb_release} returns a C{dict} holding information from
11
the given LSB release file.
13
lsb_release_filename = self.makeFile("DISTRIB_ID=Ubuntu\n"
14
"DISTRIB_RELEASE=6.06\n"
15
"DISTRIB_CODENAME=dapper\n"
16
"DISTRIB_DESCRIPTION="
17
"\"Ubuntu 6.06.1 LTS\"\n")
19
self.assertEquals(parse_lsb_release(lsb_release_filename),
20
{"distributor-id": "Ubuntu",
21
"description": "Ubuntu 6.06.1 LTS",
23
"code-name": "dapper"})
25
def test_parse_lsb_release_with_missing_or_extra_fields(self):
27
L{parse_lsb_release} ignores lines not matching the map of
28
known keys, and returns only keys with an actual value.
30
lsb_release_filename = self.makeFile("DISTRIB_ID=Ubuntu\n"
32
self.assertEquals(parse_lsb_release(lsb_release_filename),
33
{"distributor-id": "Ubuntu"})