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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
from obsapi.buildapi import ObsBuildApi
from lxml import etree
prj = 'home:sbahling:obsapi:test'
pkg = 'suse-hello-1.0'
repo = 'SLE_12_SP3'
arch = 'x86_64'
buildapi = ObsBuildApi(apiurl='https://api.opensuse.org')
def test_build_get():
xml = buildapi.get()
assert '<directory>' in xml
def test_build_get_prj():
xml = buildapi.get(prj)
assert '<directory>' in xml
def test_build_get_repo():
xml = buildapi.get(prj, repo)
assert '<directory>' in xml
def test_build_get_arch():
xml = buildapi.get(prj, repo, arch)
assert '<directory>' in xml
def test_build_get_binary_list():
xml = buildapi.get(prj, repo, arch, pkg)
assert '<binarylist>' in xml
assert '<binary filename="suse-hello-1.0-1.1.src.rpm"' in xml
def test_build_get_binary():
bname = '_statistics'
binary = buildapi.get(prj, repo, arch, pkg, bname)
assert '<buildstatistics>' in str(binary)
def test_build_get_binary_fileinfo():
bname = 'suse-hello-1.0-1.1.src.rpm'
xml = buildapi.get(prj, repo, arch, pkg, bname, view='fileinfo')
assert '<fileinfo filename="{}">'.format(bname) in str(xml)
def test_build_get_binary_fileinfo_ext():
bname = 'suse-hello-1.0-1.1.src.rpm'
xml = buildapi.get(prj, repo, arch, pkg, bname, view='fileinfo_ext')
assert '<fileinfo filename="{}">'.format(bname) in str(xml)
assert '<requires_ext' in str(xml)
def test_build_get_builddepinfo():
xml = buildapi.get_builddepinfo(prj, pkg, repo, arch)
assert '<builddepinfo>' in xml
def test_build_get_buildconf():
buildconfig = buildapi.get_buildconfig(prj, repo)
assert '%define _project home:sbahling:obsapi:test' in buildconfig
def test_build_get_buildinfo():
xml = buildapi.get_buildinfo(prj, pkg, repo, arch)
assert '<buildinfo ' in xml
def test_build_get_jobhistory():
xml = buildapi.get_jobhistory(prj, repo, arch)
assert '<jobhistlist>' in xml
def test_build_get_jobhistory_pkg():
xml = buildapi.get_jobhistory(prj, repo, arch, pkg)
assert '<jobhistlist>' in xml
def test_build_get_result():
xml = buildapi.get_result(prj)
assert '<resultlist' in xml
def test_build_get_workerstatus():
xml = buildapi.get_workstatus()
assert '<workerstatus' in xml
def test_build_get_history():
xml = buildapi.get_history(prj, repo, arch, pkg)
assert '<buildhistory>' in xml
def test_build_get_reason():
xml = buildapi.get_reason(prj, repo, arch, pkg)
assert '<reason>' in xml
# def test_build_get_jobstatus():
# xml = buildapi.get_jobstatus(prj, repo, arch, pkg)
# assert '<None/>' in xml
def test_build_get_status():
xml = buildapi.get_status(prj, repo, arch, pkg)
assert '<status' in xml
def test_build_get_log():
log = buildapi.get_log(prj, repo, arch, pkg)
assert '[ 0s]' in log
def test_build_get_repository():
xml = buildapi.get_repository(prj, repo, arch)
assert '<binarylist' in xml
def test_build_get_repository_binary():
xml = buildapi.get_repository(prj, repo, arch)
root = etree.fromstring(xml)
entries = root.findall('binary')
assert entries is not None
for entry in entries:
bname = entry.get('filename')
size = entry.get('size')
binary = buildapi.get_repository(prj, repo, arch, bname)
assert binary is not None
assert len(binary) == int(size)
|