diff --git a/gnuviechadmin.egg-info/PKG-INFO b/gnuviechadmin.egg-info/PKG-INFO new file mode 100644 index 0000000..bab801f --- /dev/null +++ b/gnuviechadmin.egg-info/PKG-INFO @@ -0,0 +1,13 @@ +Metadata-Version: 1.0 +Name: gnuviechadmin +Version: 0.1.dev-20090705 +Summary: gnuviechadmin server administration suite +Home-page: http://www.gnuviech-server.de/projects/gnuviechadmin +Author: Jan Dittberner +Author-email: jan@dittberner.info +License: GPL +Description: this is a suite of tools for administering a server + it contains tools for maintaining e.g. clients, domains, users, mail + accounts +Keywords: administration backend frontend +Platform: UNKNOWN diff --git a/gnuviechadmin.egg-info/SOURCES.txt b/gnuviechadmin.egg-info/SOURCES.txt new file mode 100644 index 0000000..c90ae19 --- /dev/null +++ b/gnuviechadmin.egg-info/SOURCES.txt @@ -0,0 +1,38 @@ +setup.cfg +setup.py +bin/gva +bin/gvaserver +gnuviechadmin/__init__.py +gnuviechadmin/exceptions.py +gnuviechadmin.egg-info/PKG-INFO +gnuviechadmin.egg-info/SOURCES.txt +gnuviechadmin.egg-info/dependency_links.txt +gnuviechadmin.egg-info/requires.txt +gnuviechadmin.egg-info/top_level.txt +gnuviechadmin/backend/BackendEntity.py +gnuviechadmin/backend/BackendEntityHandler.py +gnuviechadmin/backend/BackendTo.py +gnuviechadmin/backend/__init__.py +gnuviechadmin/backend/client.py +gnuviechadmin/backend/domain.py +gnuviechadmin/backend/record.py +gnuviechadmin/backend/settings.py +gnuviechadmin/backend/sysuser.py +gnuviechadmin/backend/tables.py +gnuviechadmin/cli/CliCommand.py +gnuviechadmin/cli/__init__.py +gnuviechadmin/cli/client.py +gnuviechadmin/cli/domain.py +gnuviechadmin/cli/record.py +gnuviechadmin/cli/sysuser.py +gnuviechadmin/tests/__init__.py +gnuviechadmin/tests/functional/__init__.py +gnuviechadmin/tests/functional/test_util_passwordutils.py +gnuviechadmin/util/__init__.py +gnuviechadmin/util/getenttools.py +gnuviechadmin/util/gpgmail.py +gnuviechadmin/util/passwordutils.py +gnuviechadmin/util/stmtcreator.py +gnuviechadmin/xmlrpc/XMLRPCFacade.py +gnuviechadmin/xmlrpc/__init__.py +gnuviechadmin/xmlrpc/users.py \ No newline at end of file diff --git a/gnuviechadmin.egg-info/dependency_links.txt b/gnuviechadmin.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/gnuviechadmin.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/gnuviechadmin.egg-info/requires.txt b/gnuviechadmin.egg-info/requires.txt new file mode 100644 index 0000000..802e964 --- /dev/null +++ b/gnuviechadmin.egg-info/requires.txt @@ -0,0 +1,3 @@ +SQLAlchemy>=0.4 +sqlalchemy-migrate>=0.4 +AuthKit>=0.4 \ No newline at end of file diff --git a/gnuviechadmin.egg-info/top_level.txt b/gnuviechadmin.egg-info/top_level.txt new file mode 100644 index 0000000..6d80bf3 --- /dev/null +++ b/gnuviechadmin.egg-info/top_level.txt @@ -0,0 +1 @@ +gnuviechadmin diff --git a/gnuviechadmin/tests/functional/test_xmlrpc_users.py b/gnuviechadmin/tests/functional/test_xmlrpc_users.py new file mode 100644 index 0000000..33efca0 --- /dev/null +++ b/gnuviechadmin/tests/functional/test_xmlrpc_users.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2008 by Jan Dittberner. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# +# Version: $Id$ +"""Unit tests for gnuviechadmin.xmlrpc.users. + +""" +from gnuviechadmin.xmlrpc.users import ClientUserProvider, \ + MailuserUserProvider, SysuserUserProvider, GVAUsers +from authkit.users import AuthKitNoSuchUserError +from unittest import TestCase + + +class TestClientUserProvider(TestCase): + subject = None + + def setUp(self): + self.subject = ClientUserProvider(None) + + def test_user(self): + user = self.subject.user('dummy') + self.assertEquals(user['roles'], ['client']) + try: + user = self.subject.user('nodummy') + self.fail('should have raised AuthKitNoSuchUserError.') + except AuthKitNoSuchUserError, e: + pass + + def test_list_roles(self): + self.assertEquals(self.subject.list_roles(), ['client']) + + +class TestMailuserUserProvider(TestCase): + subject = None + + def setUp(self): + self.subject = MailuserUserProvider(None) + + def test_user(self): + try: + user = self.subject.user('dummy') + self.fail('should have raised AuthKitNoSuchUserError.') + except AuthKitNoSuchUserError, e: + pass + + def test_list_roles(self): + self.assertEquals(self.subject.list_roles(), ['mailuser']) + +class TestSysuserUserProvider(TestCase): + subject = None + + def setUp(self): + self.subject = SysuserUserProvider(None) + + def test_user(self): + try: + user = self.subject.user('dummy') + self.fail('should have raised AuthKitNoSuchUserError.') + except AuthKitNoSuchUserError, e: + pass + + def test_list_roles(self): + self.assertEquals(self.subject.list_roles(), ['sysuser']) + + +class TestGVAUsers(TestCase): + subject = None + + def setUp(self): + self.subject = GVAUsers(None, [ClientUserProvider, + MailuserUserProvider, + SysuserUserProvider]) + + def test_list_roles(self): + roles = self.subject.list_roles() + self.assertEquals(roles, ['client', 'mailuser', 'sysuser']) + + def test_role_exists(self): + self.assertFalse(self.subject.role_exists('dummy')) + for role in ('client', 'mailuser', 'sysuser'): + self.assertTrue(self.subject.role_exists(role)) + + def test_user(self): + try: + self.subject.user('nouser') + self.fail('should have raised AuthKitNoSuchUserError.') + except AuthKitNoSuchUserError, e: + pass + user = self.subject.user('dummy') + print user diff --git a/gnuviechadmin/xmlrpc/users.py b/gnuviechadmin/xmlrpc/users.py index 27cb116..9719279 100644 --- a/gnuviechadmin/xmlrpc/users.py +++ b/gnuviechadmin/xmlrpc/users.py @@ -46,11 +46,14 @@ class ClientUserProvider(UserProvider): print 'checking %s' % username if username == 'dummy': return self._get_user(username, 'client') - return AuthKitNoSuchUserError() + raise AuthKitNoSuchUserError() def list_roles(self): return ['client'] + def role_exists(self, role): + return 'client' == role + class MailuserUserProvider(UserProvider): """A UserProvider implementation class for mail users.""" @@ -61,6 +64,9 @@ class MailuserUserProvider(UserProvider): def list_roles(self): return ['mailuser'] + def role_exists(self, role): + return 'mailuser' == role + class SysuserUserProvider(UserProvider): """A UserProvider implementation class for system users.""" @@ -71,6 +77,9 @@ class SysuserUserProvider(UserProvider): def list_roles(self): return ['sysuser'] + def role_exists(self, role): + return 'sysuser' == role + class GVAUsers(Users): """This class provides an implementation of authkit.users.Users @@ -119,7 +128,6 @@ class GVAUsers(Users): try: return prov.user(username) except Exception, e: - print e - log.debug("Backend %s didn't find user %s" % (backend, + log.debug("Backend %s didn't find user %s" % (prov, username)) raise AuthKitNoSuchUserError()