incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [4/6] git commit: [#7029] ticket:521 test for additional urls in auth
Date Thu, 27 Feb 2014 22:32:56 GMT
[#7029] ticket:521 test for additional urls in auth


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/663cecad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/663cecad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/663cecad

Branch: refs/heads/master
Commit: 663cecada7a2ccefd5dc07aea733b9f69f3c64a0
Parents: a49a5c7
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Tue Feb 18 02:25:05 2014 +0400
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Thu Feb 27 21:15:21 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py                     |  4 ++-
 Allura/allura/tests/functional/test_auth.py     |  9 ------
 .../allura/tests/unit/controllers/test_auth.py  | 31 ++++++++++++++++++++
 3 files changed, 34 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/663cecad/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index b692078..072d829 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -984,6 +984,9 @@ class UserPreferencesProvider(object):
         raise NotImplementedError, 'find_by_display_name'
 
     def additional_urls(self):
+        '''
+        :return: [[str url, function], ]
+        '''
         return []
 
 
@@ -1014,7 +1017,6 @@ class LocalUserPreferencesProvider(UserPreferencesProvider):
         return users
 
 
-
 class AdminExtension(object):
 
     """

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/663cecad/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index ec7d554..bd6a4e2 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -35,7 +35,6 @@ from allura.tests import TestController
 from allura.tests import decorators as td
 from allura import model as M
 from ming.orm.ormsession import ThreadLocalORMSession, session
-from allura.controllers import BaseController
 from tg import config
 from mock import patch
 from allura.lib import plugin
@@ -70,14 +69,6 @@ class TestAuth(TestController):
             username='test-usera', password='foo'))
         assert 'Invalid login' in str(r), r.showbrowser()
 
-    #def test_auth_additional(self):
-    #    class TestControl(BaseController):
-    #        def additional_url(self):
-     #           return ['/auth/send_verification_link',]
-
-     #   r = self.app.post('/auth/do_login', params=dict(
-     #           username='test-user', password='foo'))
-
     @td.with_user_project('test-admin')
     def test_prefs(self):
         r = self.app.get('/auth/preferences/',

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/663cecad/Allura/allura/tests/unit/controllers/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/controllers/test_auth.py b/Allura/allura/tests/unit/controllers/test_auth.py
new file mode 100644
index 0000000..c35c708
--- /dev/null
+++ b/Allura/allura/tests/unit/controllers/test_auth.py
@@ -0,0 +1,31 @@
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
+
+from mock import patch
+from allura.controllers.auth import AuthController
+
+
+@patch('allura.lib.plugin.LocalUserPreferencesProvider.additional_urls')
+def test_auth_additional(additional_urls):
+
+    def test_function():
+        return 'test'
+
+    additional_urls.return_value = [['test', test_function], ]
+    auth = AuthController()
+    assert auth.test()== 'test'
\ No newline at end of file


Mime
View raw message