diff options
| author | Scott Bahling <sbahling@suse.com> | 2020-02-06 22:16:02 +0100 |
|---|---|---|
| committer | Scott Bahling <sbahling@suse.com> | 2020-02-06 22:35:43 +0100 |
| commit | cd12f43cd2c98826bb0ea092ef590a91e5842886 (patch) | |
| tree | fc13c2f90a9e3190ab172b1556dc1eb3caa124b4 /test/test_api.py | |
| parent | c86fdd52a30ca1833149d46b7fee9135a74e4598 (diff) | |
| download | obsapi-cd12f43cd2c98826bb0ea092ef590a91e5842886.tar.gz obsapi-cd12f43cd2c98826bb0ea092ef590a91e5842886.tar.xz obsapi-cd12f43cd2c98826bb0ea092ef590a91e5842886.zip | |
Handle passing bytes to the FileInfo class
Move class to own file and enhance tests
Diffstat (limited to 'test/test_api.py')
| -rw-r--r-- | test/test_api.py | 23 |
1 files changed, 7 insertions, 16 deletions
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 @@ -48,6 +48,12 @@ def project_config(): @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 """<sourceinfo package="suse-hello-1.0" rev="1" vrev="1" srcmd5="7054c47fb2ebde13fc62ee64d0a3b1bc" verifymd5="7054c47fb2ebde13fc62ee64d0a3b1bc"> <filename>suse-hello.spec</filename> @@ -95,21 +101,6 @@ def binarylist(): @pytest.fixture -def binary_fileinfo(): - return """<fileinfo filename="suse-hello-1.0-1.1.src.rpm"> -<name>suse-hello</name>i -<version>1.0</version> -<release>1.1</release> -<arch>src</arch> -<summary>Sample Kernel Module Package</summary> -<description>This package contains the hello.ko module.</description> -<size>5181</size><mtime>1507137122</mtime> -<requires>kmod-compat</requires> -<requires>kernel-syms</requires> -</fileinfo>""" - - -@pytest.fixture def project_meta(): return """<project name="home:sbahling:obsapi:test"> <title>Test project for obsapi unit tests</title> @@ -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) |
