changeset 26:eaa352730e44

Adjust test setup code to changes to the admin interface.
author Daniele Nicolodi <daniele@grinta.net>
date Mon, 27 Jun 2011 17:14:47 +0200
parents 04b93e15bb71
children 499a0bb2dc3f
files src/ltpdarepo/admin.py src/ltpdarepo/tests/__init__.py src/ltpdarepo/tests/test_users.py
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/admin.py	Mon Jun 27 16:16:07 2011 +0200
+++ b/src/ltpdarepo/admin.py	Mon Jun 27 17:14:47 2011 +0200
@@ -83,12 +83,12 @@
 cmd = commands.add(upgrade)
 cmd.add_argument('--from', type=float, dest='fromrev', metavar='REV')
 
-def useradd(username, **kwargs):
+def useradd(username, password=None, **kwargs):
     with interact(app):
         user = User.load(username)
         if user is not None:
             raise Exception('User already present')
-        user = User(username, **kwargs)
+        user = User(username, password=password, **kwargs)
         user.create()
 
 cmd = commands.add(useradd)
--- a/src/ltpdarepo/tests/__init__.py	Mon Jun 27 16:16:07 2011 +0200
+++ b/src/ltpdarepo/tests/__init__.py	Mon Jun 27 17:14:47 2011 +0200
@@ -21,13 +21,13 @@
 
 
 def doctestSetUp(self):
-    from ltpdarepo.admin import wipe, install, upgrade, adduser, admin, create_database
+    from ltpdarepo.admin import wipe, install, upgrade, useradd, grant, createdb
     wipe()
     install()
     upgrade()
-    adduser('u1', 'u1')
-    admin('u1')
-    create_database('db1')
+    useradd('u1', 'u1')
+    grant('u1', '%', ['admin', ])
+    createdb('db1')
 
 
 def doctestTearDown(self):
--- a/src/ltpdarepo/tests/test_users.py	Mon Jun 27 16:16:07 2011 +0200
+++ b/src/ltpdarepo/tests/test_users.py	Mon Jun 27 17:14:47 2011 +0200
@@ -34,11 +34,11 @@
 class DatabaseTestCase(unittest.TestCase):
 
     def setUp(self):
-        from ltpdarepo.admin import wipe, install, upgrade, adduser
+        from ltpdarepo.admin import wipe, install, upgrade, useradd
         wipe()
         install()
         upgrade()
-        adduser('u1', 'u1')
+        useradd('u1', 'u1')
 
         from ltpdarepo import app
         self.app = app