def test_buildinfo3(self): """test BuildInfo (specify binarytype)""" fname = self.fixture_file('test.spec') # if no package is specified _repository is used binfo = BuildInfo('foo', repository='openSUSE_Factory', arch='x86_64', binarytype='rpm', data=open(fname, 'r').read()) self.assertEqual(binfo.get('binarytype'), 'rpm') self.assertEqual(binfo.bdep[0].get('name'), 'aaa_base') self.assertEqual(len(list(binfo.preinstall())), 1) self.assertEqual(len(list(binfo.noinstall())), 0) self.assertEqual(len(list(binfo.cbpreinstall())), 0) self.assertEqual(len(list(binfo.cbinstall())), 0) self.assertEqual(len(list(binfo.vminstall())), 0) self.assertEqual(len(list(binfo.runscripts())), 1)
def test_buildinfo2(self): """test BuildInfo (preinstall, runscripts etc.)""" binfo = BuildInfo('foo', 'bar', 'openSUSE_Factory', 'x86_64') # check preinstall preinstall = list(binfo.preinstall()) self.assertEqual(len(preinstall), 2) self.assertEqual(preinstall[0].get('name'), 'aaa_base') self.assertEqual(preinstall[1].get('name'), 'attr') # check noinstall noinstall = list(binfo.noinstall()) self.assertEqual(len(noinstall), 4) self.assertEqual(noinstall[0].get('name'), 'install-initrd') self.assertEqual(noinstall[1].get('name'), 'install-initrd-branding-openSUSE') self.assertEqual(noinstall[2].get('name'), 'install-initrd-branding-SLED') self.assertEqual(noinstall[3].get('name'), 'installation-images') # check cbinstall cbinstall = list(binfo.cbinstall()) self.assertEqual(len(cbinstall), 2) self.assertEqual(cbinstall[0].get('name'), 'foobar') self.assertEqual(cbinstall[1].get('name'), 'baz') # check cbpreinstall cbpreinstall = list(binfo.cbpreinstall()) self.assertEqual(len(cbpreinstall), 2) self.assertEqual(cbpreinstall[0].get('name'), 'abc') self.assertEqual(cbpreinstall[1].get('name'), 'def') # check vminstall vminstall = list(binfo.vminstall()) self.assertEqual(len(vminstall), 3) self.assertEqual(vminstall[0].get('name'), 'libsepol1') self.assertEqual(vminstall[1].get('name'), 'libblkid1') self.assertEqual(vminstall[2].get('name'), 'libuuid1') # check runscripts runscripts = list(binfo.runscripts()) self.assertEqual(len(runscripts), 1) self.assertEqual(runscripts[0].get('name'), 'aaa_base')