Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tests: Add crypto patches, fix unit tests.

  • Loading branch information...
commit 523a7479021c808acc3da7f838e9fc8d2c53662f 1 parent 16b41b0
@kblin kblin authored
View
3  development.ini
@@ -54,6 +54,9 @@ create_superuser = true
smtpserver = localhost
email_from = wombat@localhost
+# Allow to disable the updater helper threads (only useful for running tests)
+multithreading = true
+
# Logging configuration
[loggers]
keys = root, routes, wombat
View
5 test.ini
@@ -19,8 +19,11 @@ port = 5000
use = config:development.ini
# Add additional test specific configuration options as necessary.
-sqlalchemy.default.url = sqlite:///%(here)s/data/test_repository.db
+sqlalchemy.url = sqlite:///%(here)s/data/test_repository.db
create_superuser = false
+multithreading = false
+
smtpserver = fake.example.com
+
View
15 wombat/lib/app_globals.py
@@ -16,12 +16,13 @@ def __init__(self):
"""
self.version = "0.5.0pre1"
- self.last_cleanup = "Never"
- self.cleanup_timer = Timer(60.0, cleanup_dbs, [self])
- self.cleanup_timer.start()
+ if config['app_conf']['multithreading'] == "true":
+ self.last_cleanup = "Never"
+ self.cleanup_timer = Timer(60.0, cleanup_dbs, [self])
+ self.cleanup_timer.start()
- self.scan_lock = Lock()
+ self.scan_lock = Lock()
- self.update_status = "Never updated"
- self.update_timer = Timer(30.0, update_media, [self])
- self.update_timer.start()
+ self.update_status = "Never updated"
+ self.update_timer = Timer(30.0, update_media, [self])
+ self.update_timer.start()
View
37 wombat/tests/test_crypto.py
@@ -0,0 +1,37 @@
+# Copyright (C) 2009 by Kai Blin
+#
+# WOMBAT 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; version 2 of the License.
+#
+# 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 St, Fifth Floor, Boston, MA 02110-1301, USA
+
+from wombat.lib.auth import crypt_password, parse_pass, check_password
+
+def test_parse_pass():
+ password = u"{method}$SALTSALT$PASSWORDPASSWORD"
+ method, salt, crypt = parse_pass(password)
+ assert method == "{method}", "failed to parse method"
+ assert salt == "SALTSALT", "failed to parse salt"
+ assert crypt == "PASSWORDPASSWORD"
+
+def test_password_MD5():
+ pass_string = crypt_password("secret")
+ method, salt, crypt = parse_pass(pass_string)
+ assert method == "{MD5}", "method is %s, not {MD5}" % method
+ assert salt is not None, "salt is None"
+ assert crypt is not None, "crypt is None"
+
+def test_check_password_MD5():
+ pass_string = crypt_password("secret")
+ assert check_password(pass_string, "secret"), "Password verification failed"
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.