blob: 18d1f15d8da553e1f0c9766e7e56fc73226f6d2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import os
import pytest
from lxml import etree
from obsapi import FileInfo
from . import test_dir
with open(os.path.join(test_dir, 'binary_fileinfo.xml'), 'rb') as f:
xml_as_bytes = f.read()
with open(os.path.join(test_dir, 'binary_fileinfo.xml'), 'r') as f:
xml_as_str = f.read()
@pytest.mark.parametrize('xml', (xml_as_bytes, xml_as_str))
def test_fileinfo(xml):
finfo = FileInfo(xml)
root = etree.fromstring(xml)
assert finfo.name == root.find('name').text
assert finfo.version == root.find('version').text
assert finfo.release == root.find('release').text
assert finfo.arch == root.find('arch').text
assert finfo.summary == root.find('summary').text
assert finfo.description == root.find('description').text
assert len(finfo.requires) == len(root.findall('requires'))
|