Fix up code review change

This commit is contained in:
Tim Bentley 2013-04-08 17:53:11 +01:00
parent e36706e3ec
commit 31b4e561b4
4 changed files with 11 additions and 13 deletions

View File

@ -62,12 +62,10 @@ class ItemCapabilities(object):
tab when making the previous item live. tab when making the previous item live.
``CanEdit`` ``CanEdit``
The capability to allow the ServiceManager to allow the item to be The capability to allow the ServiceManager to allow the item to be edited
edited
``CanMaintain`` ``CanMaintain``
The capability to allow the ServiceManager to allow the item to be The capability to allow the ServiceManager to allow the item to be reordered.
reordered.
``RequiresMedia`` ``RequiresMedia``
Determines is the service_item needs a Media Player Determines is the service_item needs a Media Player

View File

@ -132,7 +132,7 @@ from cherrypy._cpcompat import sha, ntob
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def sha_password_encrypter(password): def make_sha_hash(password):
""" """
Create an encrypted password for the given password. Create an encrypted password for the given password.
""" """
@ -145,7 +145,7 @@ def fetch_password(username):
""" """
if username != Settings().value(u'remotes/user id'): if username != Settings().value(u'remotes/user id'):
return None return None
return sha_password_encrypter(Settings().value(u'remotes/password')) return make_sha_hash(Settings().value(u'remotes/password'))
class HttpServer(object): class HttpServer(object):
@ -207,7 +207,7 @@ class HttpServer(object):
u'tools.basic_auth.on': Settings().value(u'remotes/authentication enabled'), u'tools.basic_auth.on': Settings().value(u'remotes/authentication enabled'),
u'tools.basic_auth.realm': u'OpenLP Remote Login', u'tools.basic_auth.realm': u'OpenLP Remote Login',
u'tools.basic_auth.users': fetch_password, u'tools.basic_auth.users': fetch_password,
u'tools.basic_auth.encrypt': sha_password_encrypter}, u'tools.basic_auth.encrypt': make_sha_hash},
u'/files': {u'tools.staticdir.on': True, u'/files': {u'tools.staticdir.on': True,
u'tools.staticdir.dir': self.router.html_dir, u'tools.staticdir.dir': self.router.html_dir,
u'tools.basic_auth.on': False}, u'tools.basic_auth.on': False},

View File

@ -8,7 +8,7 @@ from tempfile import mkstemp
from mock import MagicMock from mock import MagicMock
from openlp.core.lib import Settings from openlp.core.lib import Settings
from openlp.plugins.remotes.lib.httpserver import HttpRouter, fetch_password, sha_password_encrypter from openlp.plugins.remotes.lib.httpserver import HttpRouter, fetch_password, make_sha_hash
from PyQt4 import QtGui from PyQt4 import QtGui
__default_settings__ = { __default_settings__ = {
@ -62,7 +62,7 @@ class TestRouter(TestCase):
# GIVEN: A default configuration # GIVEN: A default configuration
# WHEN: called with the defined userid # WHEN: called with the defined userid
password = fetch_password(u'openlp') password = fetch_password(u'openlp')
required_password = sha_password_encrypter(u'password') required_password = make_sha_hash(u'password')
# THEN: the function should return the correct password # THEN: the function should return the correct password
self.assertEqual(password, required_password, u'The result for fetch_password should be the defined password') self.assertEqual(password, required_password, u'The result for fetch_password should be the defined password')
@ -73,12 +73,12 @@ class TestRouter(TestCase):
""" """
# GIVEN: A default configuration # GIVEN: A default configuration
# WHEN: called with the defined userid # WHEN: called with the defined userid
required_password = sha_password_encrypter(u'password') required_password = make_sha_hash(u'password')
test_value = u'5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' test_value = u'5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'
# THEN: the function should return the correct password # THEN: the function should return the correct password
self.assertEqual(required_password, test_value, self.assertEqual(required_password, test_value,
u'The result for sha_password_encrypter should return the correct encrypted password') u'The result for make_sha_hash should return the correct encrypted password')
def process_http_request_test(self): def process_http_request_test(self):
""" """

View File

@ -9,10 +9,10 @@ from mock import MagicMock
import urllib2 import urllib2
import cherrypy import cherrypy
from BeautifulSoup import BeautifulSoup, NavigableString, Tag from BeautifulSoup import BeautifulSoup
from openlp.core.lib import Settings from openlp.core.lib import Settings
from openlp.plugins.remotes.lib.httpserver import HttpServer, fetch_password, sha_password_encrypter from openlp.plugins.remotes.lib.httpserver import HttpServer
from PyQt4 import QtGui from PyQt4 import QtGui
__default_settings__ = { __default_settings__ = {