MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / test_rpm

Method test_rpm

tests/packagedcode/test_pyrpm.py:40–87  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

38 test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
39
40 def test_rpm(self):
41
42 rpm_file = self.get_test_loc('pyrpm/Eterm-0.9.3-5mdv2007.0.rpm')
43 with io.open(rpm_file, 'rb') as f:
44 rpm = pyrpm.RPM(f)
45
46 description = (
47 'Eterm is a color vt102 terminal emulator intended as a replacement for Xterm.\n'
48 'It is designed with a Freedom of Choice philosophy, leaving as much power,\n'
49 'flexibility, and freedom as possible in the hands of the user.\n\n'
50 'It is designed to look good and work well, but takes a feature-rich approach\n'
51 'rather than one of minimalism while still maintaining speed and efficiency.\n\n'
52 'It works on any windowmanager/desktop environment, although it is designed\n'
53 'to work and integrate best with Enlightenment.'
54 )
55
56 assert rpm[pyrpm.RPMTAG_NAME] == rpm.name == 'Eterm'
57 assert rpm[pyrpm.RPMTAG_VERSION] == rpm.version == '0.9.3'
58 assert rpm[pyrpm.RPMTAG_RELEASE] == '5mdv2007.0'
59 assert rpm[pyrpm.RPMTAG_ARCH] == 'i586'
60 assert rpm[pyrpm.RPMTAG_COPYRIGHT] == 'BSD'
61 assert rpm[pyrpm.RPMTAG_DESCRIPTION] == description
62 assert rpm.is_binary is True
63 assert rpm.package == 'Eterm-0.9.3'
64 assert rpm.filename == 'Eterm-0.9.3-5mdv2007.0.i586.rpm'
65
66 expected = {
67 'arch': u'i586',
68 'description': description,
69 'dist_url': None,
70 'distribution': u'Mandriva Linux',
71 'epoch': None,
72 'files_digest_algo': None,
73 'group': u'Terminals',
74 'is_binary': True,
75 'license': u'BSD',
76 'name': u'Eterm',
77 'os': u'linux',
78 'packager': u'Jerome Soyer <saispo@mandriva.org>',
79 'release': u'5mdv2007.0',
80 'source_rpm': None,
81 'summary': u'Eterm (Enlightened Terminal Emulator) is a terminal emulator',
82 'url': u'http://eterm.sourceforge.net/',
83 'vendor': u'Mandriva',
84 'version': u'0.9.3'
85 }
86
87 assert rpm.to_dict() == expected

Callers

nothing calls this directly

Calls 3

to_dictMethod · 0.95
get_test_locMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected