from obsapi.sourceapi import ObsSourceApi import os prj = 'home:sbahling:obsapi:test' pkg = 'suse-hello-1.0' repo = 'SLE_12_SP3' arch = 'x86_64' sourceapi = ObsSourceApi(apiurl='https://api.opensuse.org') modpath = os.path.dirname(os.path.realpath(__file__)) def test_source_put_meta(): prj = 'home:sbahling:obsapi:t1' with open(os.path.join(modpath, 'obsapi_test_prj_meta.xml')) as f: xml = f.read().replace('__PRJ__', prj) response = sourceapi.put_meta(prj, xml) assert '' in str(response.content) 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:Screenshots') assert '' in xml assert 'name="Screenshots"' 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