From 224e2ce1d43045e567a1c782830a24432531aa8b Mon Sep 17 00:00:00 2001 From: Scott Bahling Date: Thu, 3 Mar 2016 02:12:20 +0100 Subject: Add ObsBuildApi class --- test/test_obs_build_api.py | 124 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 test/test_obs_build_api.py (limited to 'test/test_obs_build_api.py') 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 '' in xml + + +def test_build_get_prj(): + xml = buildapi.get(prj) + assert '' in xml + + +def test_build_get_repo(): + xml = buildapi.get(prj, repo) + assert '' in xml + + +def test_build_get_arch(): + xml = buildapi.get(prj, repo, arch) + assert '' in xml + + +def test_build_get_binary_list(): + xml = buildapi.get(prj, repo, arch, pkg) + assert '' in xml + assert '' 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 ''.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 ''.format(bname) in xml + assert '' 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 '' in xml + + +def test_build_get_jobhistory_pkg(): + xml = buildapi.get_jobhistory(prj, repo, arch, pkg) + assert '' in xml + + +def test_build_get_result(): + xml = buildapi.get_result(prj) + assert '' in xml + + +def test_build_get_reason(): + xml = buildapi.get_reason(prj, repo, arch, pkg) + assert '' in xml + + +# def test_build_get_jobstatus(): +# xml = buildapi.get_jobstatus(prj, repo, arch, pkg) +# assert '' in xml + + +def test_build_get_status(): + xml = buildapi.get_status(prj, repo, arch, pkg) + assert '' 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 -- cgit v1.2.3