コード例 #1
0
def start_server():
    """Start the server if it's not already."""
    if not config.get("cp_started"):
        cherrypy.engine.start()
        config.update({"cp_started" : True})

    if not config.get("server_started"):
        startup.startTurboGears()
        config.update({"server_started" : True})
コード例 #2
0
 def test_user_password_raw_unicode(self):
     config.update({"tools.identity.soprovider.encryption_algorithm": "sha1"})
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.set_password_raw(u"garçon")
     u.sync()
     assert u.password == u"garçon"
     hub.rollback()
     hub.end()
コード例 #3
0
 def test_user_password_hashed_sha(self):
     """Test if a sha hashed password is stored in the database."""
     config.update({"tools.identity.soprovider.encryption_algorithm": "sha1"})
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.password = "******"
     u.sync()
     assert u.password == "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8"
     hub.rollback()
     hub.end()
コード例 #4
0
 def test_user_password_hashed_md5(self):
     """Test if a md5 hashed password is stored in the database."""
     config.update({"tools.identity.soprovider.encryption_algorithm": "md5"})
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.password = "******"
     u.sync()
     assert u.password == "5f4dcc3b5aa765d61d8327deb882cf99"
     hub.rollback()
     hub.end()
コード例 #5
0
 def test_user_password_raw_unicode(self):
     config.update(
         {'tools.identity.soprovider.encryption_algorithm': 'sha1'})
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.set_password_raw(u'garçon')
     u.sync()
     assert u.password == u'garçon'
     hub.rollback()
     hub.end()
コード例 #6
0
 def test_user_password_hashed_md5(self):
     """Test if a md5 hashed password is stored in the database."""
     config.update(
         {'tools.identity.soprovider.encryption_algorithm': 'md5'})
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.password = '******'
     u.sync()
     assert u.password == '5f4dcc3b5aa765d61d8327deb882cf99'
     hub.rollback()
     hub.end()
コード例 #7
0
 def test_user_password_unicode(self):
     """Test if we can set a user password which is encoded as unicode
     (no encryption algorithm)."""
     config.update({'tools.identity.soprovider.encryption_algorithm': None})
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.password = u'garçon'
     u.sync()
     assert u.password == u'garçon'
     hub.rollback()
     hub.end()
コード例 #8
0
 def test_user_password_unicode(self):
     """Test if we can set a user password which is encoded as unicode
     (no encryption algorithm)."""
     config.update({"tools.identity.soprovider.encryption_algorithm": None})
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.password = u"garçon"
     u.sync()
     assert u.password == u"garçon"
     hub.rollback()
     hub.end()
コード例 #9
0
 def test_user_password_raw(self):
     """Test that we can store raw values in the password field
     (without being hashed)."""
     config.update({"tools.identity.soprovider.encryption_algorithm": "sha1"})
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.set_password_raw("password")
     u.sync()
     assert u.password == "password"
     hub.rollback()
     hub.end()
コード例 #10
0
 def test_user_password_hashed_md5_unicode(self):
     """Test if a md5 hashed password with unicode characters is stored
     in the database."""
     config.update({"tools.identity.soprovider.encryption_algorithm": "md5"})
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.password = u"garçon"
     u.sync()
     assert u.password == "c295c4bb2672ca8c432effc53b40bb1e"
     hub.rollback()
     hub.end()
コード例 #11
0
 def test_user_password_hashed_sha_unicode(self):
     """Test if a sha hashed password with unicode characters is stored
     in the database."""
     config.update({"tools.identity.soprovider.encryption_algorithm": "sha1"})
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.password = u"garçon"
     u.sync()
     assert u.password == "442edb21c491a6e6f502eb79e98614f3c7edf43e"
     hub.rollback()
     hub.end()
コード例 #12
0
 def test_user_password_hashed_sha(self):
     """Test if a sha hashed password is stored in the database."""
     config.update(
         {'tools.identity.soprovider.encryption_algorithm': 'sha1'})
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.password = '******'
     u.sync()
     assert u.password == '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'
     hub.rollback()
     hub.end()
コード例 #13
0
 def test_user_password_hashed_sha_unicode(self):
     """Test if a sha hashed password with unicode characters is stored
     in the database."""
     config.update(
         {'tools.identity.soprovider.encryption_algorithm': 'sha1'})
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.password = u'garçon'
     u.sync()
     assert u.password == '442edb21c491a6e6f502eb79e98614f3c7edf43e'
     hub.rollback()
     hub.end()
コード例 #14
0
 def test_user_password_hashed_md5_unicode(self):
     """Test if a md5 hashed password with unicode characters is stored
     in the database."""
     config.update(
         {'tools.identity.soprovider.encryption_algorithm': 'md5'})
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.password = u'garçon'
     u.sync()
     assert u.password == 'c295c4bb2672ca8c432effc53b40bb1e'
     hub.rollback()
     hub.end()
コード例 #15
0
 def test_user_password_raw(self):
     """Test that we can store raw values in the password field
     (without being hashed)."""
     config.update(
         {'tools.identity.soprovider.encryption_algorithm': 'sha1'})
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.set_password_raw('password')
     u.sync()
     assert u.password == 'password'
     hub.rollback()
     hub.end()
コード例 #16
0
 def test_user_password_hashed_md5_utf8string(self):
     """Test if a md5 hashed password with unicode characters is stored in
     the database if the password is entered as str (encoded in UTF-8). This
     test ensures that the encryption algorithm does handle non-unicode
     parameters gracefully."""
     config.update({"tools.identity.soprovider.encryption_algorithm": "md5"})
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.password = u"garçon".encode("UTF-8")
     u.sync()
     assert u.password == "c295c4bb2672ca8c432effc53b40bb1e"
     hub.rollback()
     hub.end()
コード例 #17
0
 def test_user_password_hashed_md5_utf8string(self):
     """Test if a md5 hashed password with unicode characters is stored in
     the database if the password is entered as str (encoded in UTF-8). This
     test ensures that the encryption algorithm does handle non-unicode
     parameters gracefully."""
     config.update(
         {'tools.identity.soprovider.encryption_algorithm': 'md5'})
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.password = u'garçon'.encode('UTF-8')
     u.sync()
     assert u.password == 'c295c4bb2672ca8c432effc53b40bb1e'
     hub.rollback()
     hub.end()
コード例 #18
0
 def test_user_password_hashed_custom(self):
     """Test if a custom hashed password is stored in the database."""
     config.update(
         {
             "tools.identity.soprovider.encryption_algorithm": "custom",
             "tools.identity.custom_encryption": "identity.tests.test_identity.mycustomencrypt",
         }
     )
     # force new config values to load
     startup.startTurboGears()
     self.app.get("/")
     hub.begin()
     u = TG_User.by_user_name("samIam")
     u.password = "******"
     u.sync()
     assert u.password == "password_custom"
     hub.rollback()
     hub.end()
コード例 #19
0
 def test_user_password_hashed_custom(self):
     """Test if a custom hashed password is stored in the database."""
     config.update({
         'tools.identity.soprovider.encryption_algorithm':
         'custom',
         'tools.identity.custom_encryption':
         'identity.tests.test_identity.mycustomencrypt'
     })
     # force new config values to load
     startup.startTurboGears()
     self.app.get('/')
     hub.begin()
     u = TG_User.by_user_name('samIam')
     u.password = '******'
     u.sync()
     assert u.password == 'password_custom'
     hub.rollback()
     hub.end()
コード例 #20
0
 def setUp(self):
     self._identity_on = config.get("tools.identity.on", False)
     config.update({"tools.identity.on": False})
     startup.startTurboGears()
     testutil.DBTest.setUp(self)
コード例 #21
0
 def setUp(self):
     self._identity_on = config.get('tools.identity.on', False)
     config.update({'tools.identity.on': False})
     startup.startTurboGears()
     testutil.DBTest.setUp(self)