From 6ff6b6ba188bbadffb619edf16475c896a447aef Mon Sep 17 00:00:00 2001 From: Scott Bahling Date: Thu, 3 Mar 2016 02:11:36 +0100 Subject: Add ObsSourceApi class --- test/test_obs_source_api.py | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 test/test_obs_source_api.py (limited to 'test') diff --git a/test/test_obs_source_api.py b/test/test_obs_source_api.py new file mode 100644 index 0000000..205e344 --- /dev/null +++ b/test/test_obs_source_api.py @@ -0,0 +1,68 @@ +from obsapi.sourceapi import ObsSourceApi + + +prj = 'Test:obsapi' +pkg = 'suse-hello-1.0' +repo = 'SLE_12' +arch = 'x86_64' + +sourceapi = ObsSourceApi(apiurl='https://api.suse.com') + + +def test_source_get_prj(): + xml = sourceapi.get(prj) + assert '' in xml + + +def test_source_get_pkg(): + xml = sourceapi.get(prj, pkg) + assert ''.format(prj) in xml + + +def test_source_get_meta_pkg(): + xml = sourceapi.get_meta(prj, pkg) + assert ''.format(pkg, prj) in xml + + +def test_source_get_prj_attributes(): + xml = sourceapi.get_attribute(prj) + assert '' in xml + + +def test_source_get_prj_attribute(): + xml = sourceapi.get_attribute(prj, attribute='OBS:MaintenanceIdTemplate') + assert '' in xml + assert 'name="MaintenanceIdTemplate"' in xml + assert 'namespace="OBS"' in xml + + +def test_source_get_pkg_attributes(): + xml = sourceapi.get_attribute(prj, pkg) + assert '' in xml + assert 'name="ScreenShots"' in xml + assert 'namespace="OBS"' in xml + + +def test_source_get_prj_config(): + config = sourceapi.get_config(prj) + assert 'Macros:' in config + + +def test_source_get_prj_pubkey(): + pubkey = sourceapi.get_pubkey(prj) + assert '-BEGIN PGP PUBLIC KEY BLOCK-' in pubkey + + +def test_source_get_history(): + xml = sourceapi.get_history(prj, pkg) + assert '' in xml -- cgit v1.2.3