]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/commitdiff
Fixed broken MediaWikiUsers class
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 29 Mar 2009 09:23:06 +0000 (09:23 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 29 Mar 2009 09:23:06 +0000 (09:23 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/wradmin@437 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wradmin/wradmin/lib/mediawiki.py
wradmin/wradmin/tests/functional/test_bericht.py
wradmin/wradmin/tests/functional/test_rodelbahn.py
wradmin/wradmin/tests/test_lib.py [new file with mode: 0644]

index 6e725b4ae69511b57c11b5036d23f86ad66b33a1..98da47a071e6d556cbd83e3bb6782c44c1efeffb 100644 (file)
@@ -3,6 +3,7 @@
 from authkit.users import UsersReadOnly, md5
 import datetime
 import re
+import wradmin.model as model
 
 import logging
 log = logging.getLogger(__name__)
@@ -101,11 +102,10 @@ class MediaWikiUsers(UsersReadOnly):
         self.emails = {} # E-Mail addresses of the users
         
         # Query database
-        con = get_wiki_connection()
-        cu = con.cursor()
+        con = model.meta.engine.connect()
         sql = 'SELECT user_id, user_name, user_real_name, user_password, user_email FROM user'
-        cu.execute(sql)
-        for row in cu:
+        result = con.execute(sql)
+        for row in result:
             user_id, username, real_name, password, email = row
             username = username.lower()
             role = []
@@ -118,6 +118,7 @@ class MediaWikiUsers(UsersReadOnly):
             self.user_ids[username] = user_id
             self.real_names[username] = real_name
             self.emails[username] = email
+        con.close()
         log.info("%d users loaded from the MediaWiki database" % len(self.usernames))
     
     
index e92cde674eba86af1a3f1c7c4930c9fc1ea1749f..57b88ecb91e5768788ea167f781e25ab4a36eda0 100644 (file)
@@ -2,6 +2,10 @@ from wradmin.tests import *
 
 class TestBerichtController(TestController):
 
-    def test_index(self):
-        response = self.app.get(url(controller='bericht', action='index'))
+    def test_list(self):
+        response = self.app.get(url(controller='bericht', action='list'))
+        # Test response...
+
+    def test_view(self):
+        response = self.app.get(url(controller='bericht', action='view', id=100))
         # Test response...
index 7b1e7d38c6c097dfb393852b260645cd49a44e2e..4053de36e386a9fa3a0caf24943342b0e91b7ab3 100644 (file)
@@ -5,3 +5,13 @@ class TestRodelbahnController(TestController):
     def test_index(self):
         response = self.app.get(url(controller='rodelbahn', action='index'))
         # Test response...
+    
+    
+    def test_list(self):
+        response = self.app.get(url(controller='rodelbahn', action='list'))
+        # Test response...
+    
+    
+    def test_view(self):
+        response = self.app.get(url(controller='rodelbahn', action='view', id=5))
+        # Test response...
\ No newline at end of file
diff --git a/wradmin/wradmin/tests/test_lib.py b/wradmin/wradmin/tests/test_lib.py
new file mode 100644 (file)
index 0000000..c764688
--- /dev/null
@@ -0,0 +1,5 @@
+import wradmin.lib
+
+def test_mediawiki_users():
+    users = wradmin.lib.mediawiki.MediaWikiUsers(True)
+    assert len(users.usernames) >= 1 # We have at least one user
\ No newline at end of file