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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
from obsapi import ObsApi
from lxml import etree
api = ObsApi(apiurl='https://api.suse.com')
prj = 'Test:obsapi'
pkg = 'suse-hello-1.0'
repo = 'SLE_12'
arch = 'x86_64'
def test_get_package_meta():
try:
response = etree.fromstring(api.get_package_meta(prj=prj, pkg=pkg))
except:
response = {}
assert response.get('name', None) == 'suse-hello-1.0'
def test_ls_prj():
assert api.ls(prj=prj) == ['suse-hello-1.0']
def test_ls_pkg():
files = ['COPYING', 'suse-hello-1.0.tar.bz2',
'suse-hello.changes', 'suse-hello.spec',
]
directory, listing = api.ls(prj=prj, pkg=pkg)
assert directory.name == 'suse-hello-1.0'
items = [i.name for i in listing]
for f in files:
assert f in items
def test_ls_binaries():
files = ['_statistics', 'rpmlint.log', 'suse-hello-1.0-2.1.src.rpm',
'suse-hello-kmp-default-1.0_k3.12.28_4-2.1.x86_64.rpm',
]
listing = api.ls(prj=prj, pkg=pkg, repo=repo, arch=arch)
items = [i.filename for i in listing]
for f in files:
assert f in items
def test_binaries_ls():
files = ['_statistics', 'rpmlint.log', 'suse-hello-1.0-2.1.src.rpm',
'suse-hello-kmp-default-1.0_k3.12.28_4-2.1.x86_64.rpm',
]
listing = api.binaries_ls(prj=prj, pkg=pkg, repo=repo, arch=arch)
items = [i.filename for i in listing]
for f in files:
assert f in items
def test_get_vendor():
assert api.get_vendor(prj=prj) == u'Test:obsapi'
def test_source_info():
sinfo = api.get_source_info(prj, pkg)
assert sinfo.package == 'suse-hello-1.0'
assert sinfo.rev == '2'
assert sinfo.vrev == '2'
assert sinfo.srcmd5 == '7054c47fb2ebde13fc62ee64d0a3b1bc'
assert sinfo.verifymd5 == '7054c47fb2ebde13fc62ee64d0a3b1bc'
|