summaryrefslogtreecommitdiff
path: root/test/test_api.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_api.py')
-rw-r--r--test/test_api.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_api.py b/test/test_api.py
index e45a284..a6f74c1 100644
--- a/test/test_api.py
+++ b/test/test_api.py
@@ -348,6 +348,22 @@ def test_get_binary_fileinfo(requests_mock, binary_fileinfo):
assert bfinfo.requires == [p.text for p in expected_bfinfo.findall('requires')]
+def test_get_package_version(requests_mock, binarylist, binary_fileinfo):
+ matcher = re.compile('/build/.*/.*/.*/.*')
+ requests_mock.get(matcher, text=binarylist)
+ matcher = re.compile('/build/.*/.*/.*/.*/.*?view=fileinfo')
+ requests_mock.get(matcher, content=binary_fileinfo)
+
+ root = etree.fromstring(binary_fileinfo.decode('utf-8'))
+ expected_version = root.find('version').text
+ expected_release = root.find('release').text
+ full_version = api.get_package_version(prj, pkg, repo, arch)
+ assert full_version == '{}-{}'.format(expected_version, expected_release)
+
+ version = api.get_package_version(prj, pkg, repo, arch, full=False)
+ assert version == expected_version
+
+
def test_get_project_flags(requests_mock, project_meta):
matcher = prj_meta_re
requests_mock.get(matcher, text=project_meta)