Commit 9c2719b0 authored by Jérome Perrin's avatar Jérome Perrin

access_token: fix problems reported by pylint

parent f1bbc5aa
alpha = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' alpha = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
random_id = '' random_id = ''
for i in range(0,128): for _ in range(0, 128):
random_id += random.choice(alpha) random_id += random.choice(alpha)
# Define Reference from ID provided by portal_ids # Define Reference from ID provided by portal_ids
......
...@@ -56,7 +56,9 @@ class TestERP5DumbHTTPExtractionPlugin(ERP5TypeTestCase): ...@@ -56,7 +56,9 @@ class TestERP5DumbHTTPExtractionPlugin(ERP5TypeTestCase):
transaction.commit() transaction.commit()
self.tic() self.tic()
def do_fake_request(self, request_method, headers={}): def do_fake_request(self, request_method, headers=None):
if headers is None:
headers = {}
__version__ = "0.1" __version__ = "0.1"
env={} env={}
env['SERVER_NAME']='bobo.server' env['SERVER_NAME']='bobo.server'
...@@ -103,7 +105,7 @@ class TestERP5DumbHTTPExtractionPlugin(ERP5TypeTestCase): ...@@ -103,7 +105,7 @@ class TestERP5DumbHTTPExtractionPlugin(ERP5TypeTestCase):
return person return person
def test_working_authentication(self): def test_working_authentication(self):
person = self.person = self._createPerson(self.new_id, "test") self._createPerson(self.new_id, "test")
request = self.do_fake_request("GET", {"HTTP_AUTHORIZATION": "Basic " + base64.b64encode("%s:test" % self.new_id)}) request = self.do_fake_request("GET", {"HTTP_AUTHORIZATION": "Basic " + base64.b64encode("%s:test" % self.new_id)})
ret = ERP5DumbHTTPExtractionPlugin("default_extraction").extractCredentials(request) ret = ERP5DumbHTTPExtractionPlugin("default_extraction").extractCredentials(request)
self.assertEquals(ret, {'login': self.new_id, 'password': 'test', 'remote_host': 'bobo.remote.host', 'remote_address': '204.183.226.81 '}) self.assertEqual(ret, {'login': self.new_id, 'password': 'test', 'remote_host': 'bobo.remote.host', 'remote_address': '204.183.226.81 '})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment