From cd12f43cd2c98826bb0ea092ef590a91e5842886 Mon Sep 17 00:00:00 2001 From: Scott Bahling Date: Thu, 6 Feb 2020 22:16:02 +0100 Subject: Handle passing bytes to the FileInfo class Move class to own file and enhance tests --- test/test_api.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'test/test_api.py') diff --git a/test/test_api.py b/test/test_api.py index 5769543..e45a284 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -47,6 +47,12 @@ def project_config(): return f.read() +@pytest.fixture +def binary_fileinfo(): + with open(os.path.join(test_dir, 'binary_fileinfo.xml'), 'rb') as f: + return f.read() + + @pytest.fixture def source_info(): return """ @@ -94,21 +100,6 @@ def binarylist(): """ -@pytest.fixture -def binary_fileinfo(): - return """ -suse-helloi -1.0 -1.1 -src -Sample Kernel Module Package -This package contains the hello.ko module. -51811507137122 -kmod-compat -kernel-syms -""" - - @pytest.fixture def project_meta(): return """ @@ -340,7 +331,7 @@ def test_source_info(requests_mock, source_info, rev): def test_get_binary_fileinfo(requests_mock, binary_fileinfo): matcher = re.compile('/build/.*/.*/.*/.*/.*?view=fileinfo') - requests_mock.get(matcher, text=binary_fileinfo) + requests_mock.get(matcher, content=binary_fileinfo) binary = 'suse-hello-1.0-1.1.src.rpm' expected_bfinfo = etree.fromstring(binary_fileinfo) -- cgit v1.2.3