Permalink
Browse files

Change structure of files according to docs on flask extension develo…

…pment.
  • Loading branch information...
1 parent 5289344 commit 91d50ee2eabd73b4494b82a088926c12ba98567b @alekzvik alekzvik committed Apr 7, 2012
Showing with 9 additions and 12 deletions.
  1. 0 flaskext/bcrypt.py → flask_bcrypt.py
  2. +0 −1 flaskext/__init__.py
  3. +1 −2 setup.py
  4. +8 −9 test_bcrypt.py
File renamed without changes.
View
@@ -1 +0,0 @@
-__import__('pkg_resources').declare_namespace(__name__)
View
@@ -16,8 +16,7 @@
author_email='maxc@me.com',
description='Brcrypt hashing for Flask.',
long_description=__doc__,
- packages=['flaskext'],
- namespace_packages=['flaskext'],
+ py_modules=['flask_bcrypt'],
zip_safe=False,
platforms='any',
install_requires=[
View
@@ -1,29 +1,29 @@
import unittest
import flask
-from flaskext.bcrypt import Bcrypt, generate_password_hash, check_password_hash
+from flask_bcrypt import Bcrypt, generate_password_hash, check_password_hash
class BasicTestCase(unittest.TestCase):
-
+
def setUp(self):
app = flask.Flask(__name__)
app.config['BCRYPT_LOG_ROUNDS'] = 6
self.bcrypt = Bcrypt(app)
-
+
def test_is_string(self):
pw_hash = self.bcrypt.generate_password_hash('secret')
self.assertTrue(isinstance(pw_hash, str))
-
+
def test_not_string(self):
pw_hash = self.bcrypt.generate_password_hash(42)
self.assertTrue(isinstance(pw_hash, str))
-
+
def test_custom_rounds(self):
password = 'secret'
pw_hash1 = self.bcrypt.generate_password_hash(password, 5)
self.assertNotEqual(password, pw_hash1)
-
+
def test_check_hash(self):
pw_hash = self.bcrypt.generate_password_hash('secret')
# check a correct password
@@ -36,17 +36,16 @@ def test_check_hash(self):
# check helpers
pw_hash = generate_password_hash('hunter2')
self.assertTrue(check_password_hash(pw_hash, 'hunter2'))
-
+
def test_check_hash_unicode_is_utf8(self):
password = u'\u2603'
pw_hash = self.bcrypt.generate_password_hash(password)
# check a correct password
self.assertTrue(self.bcrypt.check_password_hash(pw_hash, '\xe2\x98\x83'))
-
+
def test_rounds_set(self):
self.assertEquals(self.bcrypt._log_rounds, 6)
if __name__ == '__main__':
unittest.main()
-

0 comments on commit 91d50ee

Please sign in to comment.