mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #8310 from dglaetzer/dev
Add and run tests for auth package
This commit is contained in:
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../test/unit/test_auth.py
|
||||
+1
-2
@@ -35,8 +35,7 @@ PACKAGE_DIRS=(
|
||||
)
|
||||
# containers has no tests, tool_util not yet working 100%,
|
||||
# data has many problems quota, tool shed install database, etc..
|
||||
RUN_TESTS=(1 1 1 1 1 1 1 0 1 0 0 0 0)
|
||||
|
||||
RUN_TESTS=(1 1 1 1 1 1 1 1 1 0 0 0 0)
|
||||
for ((i=0; i<${#PACKAGE_DIRS[@]}; i++)); do
|
||||
package_dir=${PACKAGE_DIRS[$i]}
|
||||
run_tests=${RUN_TESTS[$i]}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
from galaxy.auth.providers.alwaysreject import AlwaysReject
|
||||
from galaxy.auth.providers.localdb import LocalDB
|
||||
from galaxy.model import User
|
||||
|
||||
|
||||
def test_alwaysreject():
|
||||
t = AlwaysReject()
|
||||
assert t.authenticate('testmail', 'testuser', 'secret', dict()) == (None, '', '')
|
||||
|
||||
|
||||
def test_localdb():
|
||||
user = User(email='testmail', username='tester')
|
||||
user.set_password_cleartext('test')
|
||||
t = LocalDB()
|
||||
reject = t.authenticate_user(user, 'wrong', {'redact_username_in_logs': False})
|
||||
accept = t.authenticate_user(user, 'test', {'redact_username_in_logs': False})
|
||||
assert reject is False
|
||||
assert accept is True
|
||||
Reference in New Issue
Block a user