6
def __init__(self, version):
10
def __init__(self, name, version, is_installed=True):
11
self.is_installed = is_installed
13
self.installed = Version(version)
16
def __init__(self, packages=[]):
17
self.packages = packages
20
return iter(self.packages)
22
class SwprofileTests(unittest.TestCase):
24
self.lsb_desc = 'test description'
25
self.lsb_information = {'DESCRIPTION':self.lsb_desc}
26
self.testpackage = Package('testpkg', '7.77')
27
self.cache = AptCache([self.testpackage])
29
def make_profile(self, test_id='unit', cache=None, info=None):
33
info = self.lsb_information
34
return abrek.swprofile.get_sw_context(test_id, apt_cache=cache,
37
def test_pkg_name(self):
38
a = self.make_profile()
39
for pkg in a['packages']:
40
self.assertEqual(self.testpackage.name, pkg['name'])
42
def test_pkg_version(self):
43
a = self.make_profile()
44
for pkg in a['packages']:
45
self.assertEqual(self.testpackage.installed.version, pkg['version'])
47
def test_image_desc(self):
48
a = self.make_profile()
49
self.assertEqual(self.lsb_desc, a['sw_image']['desc'])