summaryrefslogtreecommitdiff
path: root/test/test_obs_build_api.py
diff options
context:
space:
mode:
authorScott Bahling <sbahling@suse.de>2016-03-03 02:12:20 +0100
committerScott Bahling <sbahling@suse.de>2016-03-03 02:12:20 +0100
commit224e2ce1d43045e567a1c782830a24432531aa8b (patch)
treeab8859ece6f78653347fbe4fad0d0e49d48122e0 /test/test_obs_build_api.py
parent6ff6b6ba188bbadffb619edf16475c896a447aef (diff)
downloadobsapi-224e2ce1d43045e567a1c782830a24432531aa8b.tar.gz
obsapi-224e2ce1d43045e567a1c782830a24432531aa8b.tar.xz
obsapi-224e2ce1d43045e567a1c782830a24432531aa8b.zip
Add ObsBuildApi class
Diffstat (limited to 'test/test_obs_build_api.py')
-rw-r--r--test/test_obs_build_api.py124
1 files changed, 124 insertions, 0 deletions
diff --git a/test/test_obs_build_api.py b/test/test_obs_build_api.py
new file mode 100644
index 0000000..08515ec
--- /dev/null
+++ b/test/test_obs_build_api.py
@@ -0,0 +1,124 @@
+from obsapi.buildapi import ObsBuildApi
+
+prj = 'Test:obsapi'
+pkg = 'suse-hello-1.0'
+repo = 'SLE_12'
+arch = 'x86_64'
+
+buildapi = ObsBuildApi(apiurl='https://api.suse.com')
+
+
+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-2.1.src.rpm"' in xml
+
+
+def test_build_get_binary():
+ bname = '_statistics'
+ binary = buildapi.get(prj, repo, arch, pkg, bname)
+ assert '<buildstatistics>' in binary
+
+
+def test_build_get_binary_fileinfo():
+ bname = 'suse-hello-1.0-2.1.src.rpm'
+ xml = buildapi.get(prj, repo, arch, pkg, bname, view='fileinfo')
+ assert '<fileinfo filename="{}">'.format(bname) in xml
+
+
+def test_build_get_binary_fileinfo_ext():
+ bname = 'suse-hello-1.0-2.1.src.rpm'
+ xml = buildapi.get(prj, repo, arch, pkg, bname, view='fileinfo_ext')
+ assert '<fileinfo filename="{}">'.format(bname) in xml
+ assert '<requires_ext' in 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 Test:obsapi' 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():
+ bname = 'suse-hello-kmp-default.rpm'
+ binary = buildapi.get_repository(prj, repo, arch, bname)
+ assert len(binary) == 25869