diff options
| -rw-r--r-- | obsapi/personapi.py | 17 | ||||
| -rw-r--r-- | test/test_obs_person_api.py | 25 |
2 files changed, 42 insertions, 0 deletions
diff --git a/obsapi/personapi.py b/obsapi/personapi.py new file mode 100644 index 0000000..85baa9e --- /dev/null +++ b/obsapi/personapi.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# +from obsapi.httpapi import ObsHttpApi + + +class ObsPersonApi(ObsHttpApi): + + rootapi = '/person/' + + def __get(self, *args, **kwargs): + return super(ObsPersonApi, self).get(*args, **kwargs) + + def get(self, user=None, **kwargs): + return self.__get(user, **kwargs) + + def get_token(self, user=None, **kwargs): + return self.__get(user, 'token', **kwargs) diff --git a/test/test_obs_person_api.py b/test/test_obs_person_api.py new file mode 100644 index 0000000..5e8e1f3 --- /dev/null +++ b/test/test_obs_person_api.py @@ -0,0 +1,25 @@ +from obsapi.personapi import ObsPersonApi + +prj = 'home:sbahling:obsapi:test' +pkg = 'suse-hello-1.0' +repo = 'SLE_12_SP3' +arch = 'x86_64' + +personapi = ObsPersonApi(apiurl='https://api.opensuse.org') + + +def test_person_get(): + xml = personapi.get() + assert '<directory' in xml + assert '<entry name="Admin"/>' in xml + + +def test_person_get_user(): + user = 'Admin' + xml = personapi.get(user) + assert '<person>' in xml + assert '<email' in xml + assert '<realname' in xml + assert '<state' in xml + assert '<globalrole' in xml + assert '<ignore_auth_service' in xml |
