Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add checksum properties to packages class #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions source/repomd.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ def build_time(self):
def location(self):
return self._element.find('common:location', namespaces=_ns).get('href')

@property
def checksum(self):
return self._element.findtext('common:checksum', namespaces=_ns)

@property
def _checksum_info(self):
return self._element.find('common:checksum', namespaces=_ns)

@property
def checksum_type(self):
return self._checksum_info.get('type')

@property
def checksum_pkgid(self):
return self._checksum_info.get('pkgid')

@property
def _version_info(self):
return self._element.find('common:version', namespaces=_ns)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_repomd.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ def test_package(chicken):
assert chicken.build_time == datetime.datetime.fromtimestamp(1525208602)
assert chicken.location == 'chicken-2.2.10-1.fc27.noarch.rpm'
assert chicken.epoch == '0'
assert chicken.checksum == '3e5d70aca9624e0c738651d1ff811de88c8e8bebfde4b52778fd264631d530fc'
assert chicken.checksum_type == 'sha256'
assert chicken.checksum_pkgid == 'YES'
assert chicken.version == '2.2.10'
assert chicken.release == '1.fc27'
assert chicken.vr == '2.2.10-1.fc27'
Expand All @@ -123,6 +126,9 @@ def test_package_with_epoch(brisket):
assert brisket.build_time == datetime.datetime.fromtimestamp(1525208602)
assert brisket.location == 'brisket-5.1.1-1.fc27.noarch.rpm'
assert brisket.epoch == '1'
assert brisket.checksum == '9f1ba9973df8f6184214ecfc67e693b96d615ef58321a62142089464f50413b9'
assert brisket.checksum_type == 'sha256'
assert brisket.checksum_pkgid == 'YES'
assert brisket.version == '5.1.1'
assert brisket.release == '1.fc27'
assert brisket.vr == '5.1.1-1.fc27'
Expand Down