From 7b4385d59808329570cde81abf7858a876cf4172 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Tue, 14 Jun 2011 14:40:09 -0500 Subject: Grammar corrections --- docs/guide/src/docbkx/identitydevguide.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/guide/src/docbkx/identitydevguide.xml b/docs/guide/src/docbkx/identitydevguide.xml index f30cb51b..97023c67 100755 --- a/docs/guide/src/docbkx/identitydevguide.xml +++ b/docs/guide/src/docbkx/identitydevguide.xml @@ -69,7 +69,7 @@ This document is intended for software developers interested - in developing applications which utilize the Cloud Identity + in developing applications that utilize the Cloud Identity Service for authentication. This document also includes details on how to integrate services with the Cloud Identity Service. @@ -82,7 +82,7 @@ The Keystone Identity Service allows applications to obtain tokens that can be used to access OpenStack resources. This document is intended for software developers interested in - developing applications which utilize the Cloud Identity + developing applications that utilize the Cloud Identity Service for authentication. This document also includes details on how to integrate services with the Cloud Identity Service. @@ -95,7 +95,7 @@ Concepts - The Keystone Identity Service has several key concepts that are + The Keystone Identity Service has several key concepts which are important to understand:
@@ -109,7 +109,7 @@ While Keystone supports token-based authentication in this release, the intention is for it to support additional protocols in the - future. The desire is to have it be an integration service, and not + future. The desire is for it to be an integration service, and not a full-fledged identity store and management solution.
@@ -117,7 +117,7 @@ Tenant A container used to group or isolate resources and/or identity - objects. Depending on the operator, a tenant may map to a customer, + objects. Depending on the service operator, a tenant may map to a customer, account, organization, or project. -- cgit From 72e4edcc12f4741bd945adf777fe43f3ffcd62d6 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Tue, 14 Jun 2011 15:07:48 -0500 Subject: Added pip requirements file for testing environments. --- README.md | 15 +++++++++------ tools/pip-requires-testing | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 tools/pip-requires-testing diff --git a/README.md b/README.md index dddf7cb1..42e35980 100644 --- a/README.md +++ b/README.md @@ -78,16 +78,17 @@ By default, configuration parameters are parsed from `etc/keystone.conf`. ## Dependencies +You may need to prefix your `pip install` commands with `sudo`, depending on your environment. +
-# Show Dependencies
+# Show dependencies
 $ cat tools/pip-requires
 
-# Install Dependencies
-$ sudo pip install -r tools/pip-requires
-
-# Keystone uses the DTest test framework for testing. Install that separately using:
-$ sudo pip install DTest
+# Install dependencies
+$ pip install -r tools/pip-requires
 
+# Install unit/functional test dependencies
+$ pip install -r tools/pip-requires-testing
 
## Running Keystone @@ -111,6 +112,8 @@ By default, configuration parameters (such as the IP and port binding for each s ## Running Tests +Before running tests, ensure you have installed the testing dependencies as described in the Dependencies section above. + #### Test data A set of sample data can be added by running a shell script: diff --git a/tools/pip-requires-testing b/tools/pip-requires-testing new file mode 100644 index 00000000..49919045 --- /dev/null +++ b/tools/pip-requires-testing @@ -0,0 +1,2 @@ +webtest +DTest \ No newline at end of file -- cgit From 90a1dfe16dbf8f748500fc7c786e696160b2ec27 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 14:27:19 -0500 Subject: Added py init files to directories already being referenced as modules --- doc/__init__.py | 0 doc/source/__init__.py | 0 examples/__init__.py | 0 examples/echo/__init__.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/__init__.py create mode 100644 doc/source/__init__.py create mode 100644 examples/__init__.py create mode 100644 examples/echo/__init__.py diff --git a/doc/__init__.py b/doc/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/doc/source/__init__.py b/doc/source/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/examples/__init__.py b/examples/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/examples/echo/__init__.py b/examples/echo/__init__.py new file mode 100644 index 00000000..e69de29b -- cgit From 062e8f47d0721516422a6527ea01ed63f672bfd1 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 14:27:44 -0500 Subject: Added pydev files to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index f03b2768..164c607c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,9 @@ .project .project/ .cache/ +.pydevproject .pydevproject/ +.settings/ keystone.db .*.swp *.log -- cgit From 15da0107e664d05a6288b1f8837652f9355f0548 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 14:28:56 -0500 Subject: Created pip requirements file for development env (added sphinx python doc generation to start) --- tools/pip-requires-development | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/pip-requires-development diff --git a/tools/pip-requires-development b/tools/pip-requires-development new file mode 100644 index 00000000..4bb2475e --- /dev/null +++ b/tools/pip-requires-development @@ -0,0 +1 @@ +Sphinx # required to build documentation \ No newline at end of file -- cgit From 2d0325c31837442c1dd41f9ddea44943be31e491 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 14:36:01 -0500 Subject: Adding py init to functional tests --- keystone/test/functional/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 keystone/test/functional/__init__.py diff --git a/keystone/test/functional/__init__.py b/keystone/test/functional/__init__.py new file mode 100644 index 00000000..e69de29b -- cgit From 07e5b8c9d6bb0525e3b2b63070642d7deacc3fcd Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 14:56:38 -0500 Subject: Fixed relative & unused imports --- keystone/test/unit/test_authn_v2.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/keystone/test/unit/test_authn_v2.py b/keystone/test/unit/test_authn_v2.py index af9d725b..92134584 100755 --- a/keystone/test/unit/test_authn_v2.py +++ b/keystone/test/unit/test_authn_v2.py @@ -17,9 +17,8 @@ import json import logging -from keystone import server -from test.unit import base -from test.unit.decorators import jsonify, xmlify +from keystone.test.unit import base +from keystone.test.unit.decorators import jsonify, xmlify logger = logging.getLogger('test.unit.test_authn_v2') -- cgit From f537c222a003fa2fdb09e8790680415f5b47b824 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 14:57:04 -0500 Subject: Added coverage to pip development requirements --- tools/pip-requires-development | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/pip-requires-development b/tools/pip-requires-development index 4bb2475e..5e9bc650 100644 --- a/tools/pip-requires-development +++ b/tools/pip-requires-development @@ -1 +1,2 @@ -Sphinx # required to build documentation \ No newline at end of file +Sphinx # required to build documentation +coverage # computes code coverage percentages \ No newline at end of file -- cgit From 091fd30f7fc82fd5ca3f3a504576732c41ff185a Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 15:20:26 -0500 Subject: Removed duplicated function --- keystone/db/sqlalchemy/api.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/keystone/db/sqlalchemy/api.py b/keystone/db/sqlalchemy/api.py index 9edcc0e6..ce655c31 100755 --- a/keystone/db/sqlalchemy/api.py +++ b/keystone/db/sqlalchemy/api.py @@ -689,14 +689,6 @@ def user_delete_tenant(id, tenant_id, session=None): session.delete(group_user) -def user_get_by_tenant(user_id, tenant_id, session=None): - if not session: - session = get_session() - result = session.query(models.User).filter_by(id=user_id, - tenant_id=tenant_id).first() - return result - - def users_get_by_tenant(user_id, tenant_id, session=None): if not session: session = get_session() @@ -867,7 +859,7 @@ def users_get_page(marker, limit, session=None): return session.query(user).\ order_by("id").limit(limit).all() -def users_get_page_markers(marker, limit,\ +def users_get_page_markers(marker, limit, \ session=None): if not session: session = get_session() @@ -930,7 +922,7 @@ def users_get_by_tenant_get_page(tenant_id, marker, limit, session=None): "id").limit(limit).all() -def users_get_by_tenant_get_page_markers(tenant_id, marker, limit,\ +def users_get_by_tenant_get_page_markers(tenant_id, marker, limit, \ session=None): if not session: session = get_session() -- cgit From 4fcf3e86e42aaf7c2e7be8dec79318221423370c Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 15:36:16 -0500 Subject: Fixed imports in auth_protocols --- keystone/auth_protocols/auth_basic.py | 15 +++++++++------ keystone/auth_protocols/auth_openid.py | 10 +++++++++- keystone/auth_protocols/auth_token.py | 9 ++++----- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/keystone/auth_protocols/auth_basic.py b/keystone/auth_protocols/auth_basic.py index 9c9bae6f..b2631614 100644 --- a/keystone/auth_protocols/auth_basic.py +++ b/keystone/auth_protocols/auth_basic.py @@ -31,11 +31,14 @@ This is an Auth component as per: http://wiki.openstack.org/openstack-authn """ -from paste.deploy import loadapp +import os +import urlparse import eventlet from eventlet import wsgi -import os -from webob.exc import HTTPUnauthorized, HTTPInternalServerError +from paste.deploy import loadapp +from keystone.common.bufferedhttp import http_connect_raw as http_connect +from webob.exc import Request, Response +from webob.exc import HTTPUnauthorized PROTOCOL_NAME = "Basic Authentication" @@ -100,7 +103,7 @@ class AuthProtocol(object): # Claims were provided - validate them import base64 auth_header = env['HTTP_AUTHORIZATION'] - auth_type, encoded_creds = auth_header.split(None, 1) + _auth_type, encoded_creds = auth_header.split(None, 1) user, password = base64.b64decode(encoded_creds).split(':', 1) if not self.validateCreds(user, password): #Claims were rejected @@ -148,8 +151,8 @@ class AuthProtocol(object): def validateCreds(self, username, password): #stub for password validation. - import ConfigParser - import hashlib + # import ConfigParser + # import hashlib #usersConfig = ConfigParser.ConfigParser() #usersConfig.readfp(open('/etc/openstack/users.ini')) #password = hashlib.sha1(password).hexdigest() diff --git a/keystone/auth_protocols/auth_openid.py b/keystone/auth_protocols/auth_openid.py index 350d5c46..1586537a 100644 --- a/keystone/auth_protocols/auth_openid.py +++ b/keystone/auth_protocols/auth_openid.py @@ -17,6 +17,13 @@ # limitations under the License. # Not Yet PEP8 standardized +import os +import urlparse +import eventlet +from eventlet import wsgi +from keystone.common.bufferedhttp import http_connect_raw as http_connect +from webob.exc import Request, Response +from paste.deploy import loadapp """ OPENID AUTH MIDDLEWARE - STUB @@ -75,13 +82,14 @@ class AuthProtocol(object): env['HTTP_AUTHORIZATION'] = "Basic %s" % self.service_pass return self.app(env, custom_start_response) + proxy_headers = [] proxy_headers['AUTHORIZATION'] = "Basic %s" % self.service_pass # We are forwarding to a remote service (no downstream WSGI app) req = Request(proxy_headers) parsed = urlparse(req.url) conn = http_connect(self.service_host, self.service_port, \ req.method, parsed.path, \ - proxy_headers,\ + proxy_headers, \ ssl=(self.service_protocol == 'https')) resp = conn.getresponse() data = resp.read() diff --git a/keystone/auth_protocols/auth_token.py b/keystone/auth_protocols/auth_token.py index 95d8fa2a..1734dd3c 100755 --- a/keystone/auth_protocols/auth_token.py +++ b/keystone/auth_protocols/auth_token.py @@ -57,7 +57,6 @@ import httplib import json import os from paste.deploy import loadapp -import sys from urlparse import urlparse from webob.exc import HTTPUnauthorized, HTTPUseProxy from webob.exc import Request, Response @@ -98,7 +97,7 @@ class AuthProtocol(object): def _init_protocol(self, app, conf): """ Protocol specific initialization """ - # where to find the auth service (we use this to validate tokens) + # where to find the auth service (we use this to validate tokens) self.auth_host = conf.get('auth_host') self.auth_port = int(conf.get('auth_port')) self.auth_protocol = conf.get('auth_protocol', 'https') @@ -236,7 +235,7 @@ class AuthProtocol(object): conn = http_connect(self.auth_host, self.auth_port, 'GET', '/v2.0/tokens/%s' % claims, headers=headers) resp = conn.getresponse() - data = resp.read() + # data = resp.read() conn.close() if not str(resp.status).startswith('20'): @@ -271,8 +270,8 @@ class AuthProtocol(object): token_info = json.loads(data) #TODO(Ziad): make this more robust #first_group = token_info['auth']['user']['groups']['group'][0] - roles =[] - role_refs =token_info["auth"]["user"]["roleRefs"] + roles = [] + role_refs = token_info["auth"]["user"]["roleRefs"] if role_refs != None: for role_ref in role_refs: roles.append(role_ref["roleId"]) -- cgit From 0af8ae52797b4f761df881462a2a59df582d021e Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 16:02:47 -0500 Subject: Removed unused imports and denoted unused variables --- keystone/db/sqlalchemy/api.py | 8 ++++---- keystone/db/sqlalchemy/models.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/keystone/db/sqlalchemy/api.py b/keystone/db/sqlalchemy/api.py index ce655c31..d3146913 100755 --- a/keystone/db/sqlalchemy/api.py +++ b/keystone/db/sqlalchemy/api.py @@ -1006,11 +1006,11 @@ def groups_get_by_user_get_page_markers(user_id, marker, limit, session=None): session = get_session() uga = aliased(models.UserGroupAssociation) group = aliased(models.Group) - first, firstassoc = session.query(group, uga).\ + first, _firstassoc = session.query(group, uga).\ join((uga, uga.group_id == group.id)).\ filter(uga.user_id == user_id).\ order_by(group.id).first() - last, lastassoc = session.query(group, uga).\ + last, _lastassoc = session.query(group, uga).\ join((uga, uga.group_id == group.id)).\ filter(uga.user_id == user_id).\ order_by(group.id.desc()).first() @@ -1037,12 +1037,12 @@ def groups_get_by_user_get_page_markers(user_id, marker, limit, session=None): if next_len == 0: next = last else: - for t, a in next: + for t, _a in next: next = t if prev_len == 0: prev = first else: - for t, a in prev: + for t, _a in prev: prev = t if first.id == marker: prev = None diff --git a/keystone/db/sqlalchemy/models.py b/keystone/db/sqlalchemy/models.py index 79d3dc3a..d9b3af63 100644 --- a/keystone/db/sqlalchemy/models.py +++ b/keystone/db/sqlalchemy/models.py @@ -15,7 +15,7 @@ # limitations under the License. # Not Yet PEP8 standardized -from sqlalchemy import create_engine, Column, String, Integer, ForeignKey,\ +from sqlalchemy import Column, String, Integer, ForeignKey, \ UniqueConstraint, Boolean from sqlalchemy import DateTime from sqlalchemy.exc import IntegrityError -- cgit From c2885d531a5952795340cb2e2effcf3fa3eeb6f5 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 16:03:23 -0500 Subject: Fixed imports in keystone.common --- keystone/common/config.py | 6 ------ keystone/common/exception.py | 2 -- keystone/common/template.py | 13 +++++++------ keystone/common/wsgi.py | 2 -- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/keystone/common/config.py b/keystone/common/config.py index 34281192..71925239 100755 --- a/keystone/common/config.py +++ b/keystone/common/config.py @@ -20,18 +20,12 @@ Routines for configuring OpenStack Service """ -import ConfigParser -import logging import logging.config -import logging.handlers import optparse import os from paste import deploy -import re import sys -import keystone.common.exception as exception - DEFAULT_LOG_FORMAT = "%(asctime)s %(levelname)8s [%(name)s] %(message)s" DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" diff --git a/keystone/common/exception.py b/keystone/common/exception.py index fb64220d..ee4f4392 100755 --- a/keystone/common/exception.py +++ b/keystone/common/exception.py @@ -22,8 +22,6 @@ OpenStack-type exceptions. SHOULD include dedicated exception logging. """ import logging -import sys -import traceback class ProcessExecutionError(IOError): diff --git a/keystone/common/template.py b/keystone/common/template.py index f8412d62..23910d85 100644 --- a/keystone/common/template.py +++ b/keystone/common/template.py @@ -45,6 +45,7 @@ import re import os import functools import time +import tokenize from webob import Response import keystone.logic.types.fault as fault @@ -124,7 +125,7 @@ class BaseTemplate(object): class SimpleTemplate(BaseTemplate): - blocks = ('if','elif','else','try','except','finally','for','while','with','def','class') + blocks = ('if', 'elif', 'else', 'try', 'except', 'finally', 'for', 'while', 'with', 'def', 'class') dedent_blocks = ('elif', 'else', 'except', 'finally') def prepare(self, escape_func=cgi.escape, noescape=False): @@ -163,7 +164,7 @@ class SimpleTemplate(BaseTemplate): try: tokens = list(tokenize.generate_tokens(iter(line).next)) except tokenize.TokenError: - return line.rsplit('#',1) if '#' in line else (line, '') + return line.rsplit('#', 1) if '#' in line else (line, '') for token in tokens: if token[0] == tokenize.COMMENT: start, end = token[2][1], token[3][1] @@ -181,7 +182,7 @@ class SimpleTemplate(BaseTemplate): cline += '_str(%s)' % value elif token == 'CMD': cline += '_escape(%s)' % value - cline += ', ' + cline += ', ' cline = cline[:-2] + '\\\n' cline = cline[:-2] if cline[:-1].endswith('\\\\\\\\\\n'): @@ -201,9 +202,9 @@ class SimpleTemplate(BaseTemplate): if lineno <= 2: m = re.search(r"%.*coding[:=]\s*([-\w\.]+)", line) if m: self.encoding = m.group(1) - if m: line = line.replace('coding','coding (removed)') + if m: line = line.replace('coding', 'coding (removed)') if line.strip()[:2].count('%') == 1: - line = line.split('%',1)[1].lstrip() # Full line following the % + line = line.split('%', 1)[1].lstrip() # Full line following the % cline = split_comment(line)[0].strip() cmd = re.split(r'[^a-zA-Z0-9_]', cline)[0] flush() ##encodig (TODO: why?) @@ -319,7 +320,7 @@ def template(tpl, template_adapter=SimpleTemplate, **kwargs): You can use a name, a filename or a template string as first parameter. ''' if tpl not in TEMPLATES or DEBUG: - settings = kwargs.get('template_settings',{}) + settings = kwargs.get('template_settings', {}) lookup = kwargs.get('template_lookup', TEMPLATE_PATH) if isinstance(tpl, template_adapter): TEMPLATES[tpl] = tpl diff --git a/keystone/common/wsgi.py b/keystone/common/wsgi.py index 1f48137c..b89732f9 100755 --- a/keystone/common/wsgi.py +++ b/keystone/common/wsgi.py @@ -26,10 +26,8 @@ import logging import sys import datetime -import eventlet import eventlet.wsgi eventlet.patcher.monkey_patch(all=False, socket=True) -import routes import routes.middleware import webob.dec import webob.exc -- cgit From 963abf125755899e3886027e7e3565f8fe74fafa Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 16:04:40 -0500 Subject: Fixed imports; improved PEP8 formatting compliance --- keystone/test/unit/test_server.py | 49 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/keystone/test/unit/test_server.py b/keystone/test/unit/test_server.py index 031015a2..7501b8ae 100755 --- a/keystone/test/unit/test_server.py +++ b/keystone/test/unit/test_server.py @@ -5,8 +5,8 @@ import json sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..', '..', '..', '..', 'keystone'))) - -from keystone import server + +from keystone import utils import keystone.logic.types.auth as auth import keystone.logic.types.fault as fault @@ -14,7 +14,6 @@ from StringIO import StringIO from datetime import date from lxml import etree from webob import Request -from webob import Response class TestServer(unittest.TestCase): '''Unit tests for server.py.''' @@ -25,19 +24,19 @@ class TestServer(unittest.TestCase): def setUp(self): environ = {'wsgi.url_scheme': 'http'} self.request = Request(environ) - self.auth_data = auth.AuthData(auth.Token(date.today(),"2231312"), auth.User("username","12345",auth.Groups([],[]))) + self.auth_data = auth.AuthData(auth.Token(date.today(), "2231312"), auth.User("username", "12345", auth.Groups([], []))) #def tearDown(self): def test_is_xml_response(self): - self.assertFalse(server.is_xml_response(self.request)) + self.assertFalse(utils.is_xml_response(self.request)) self.request.headers["Accept"] = "application/xml" - self.request.content_type="application/json" - self.assertTrue(server.is_xml_response(self.request)) + self.request.content_type = "application/json" + self.assertTrue(utils.is_xml_response(self.request)) def test_send_result_xml(self): self.request.headers["Accept"] = "application/xml" - response = server.send_result(200,self.request,self.auth_data); + response = utils.send_result(200, self.request, self.auth_data); self.assertTrue(response.headers['content-type'] == "application/xml; charset=UTF-8") xml = etree.fromstring(response.unicode_body) @@ -45,42 +44,42 @@ class TestServer(unittest.TestCase): user = xml.find("{http://docs.openstack.org/identity/api/v2.0}user") token = xml.find("{http://docs.openstack.org/identity/api/v2.0}token") - self.assertTrue(user.get("username"),"username") - self.assertTrue(user.get("tenantId"),'12345'); - self.assertTrue(token.get("id"),'2231312'); - self.assertTrue(token.get("expires"),date.today()); + self.assertTrue(user.get("username"), "username") + self.assertTrue(user.get("tenantId"), '12345'); + self.assertTrue(token.get("id"), '2231312'); + self.assertTrue(token.get("expires"), date.today()); def test_send_result_json(self): self.request.headers["Accept"] = "application/json" - response = server.send_result(200,self.request,self.auth_data); + response = utils.send_result(200, self.request, self.auth_data); self.assertTrue(response.headers['content-type'] == "application/json; charset=UTF-8") dict = json.loads(response.unicode_body) - self.assertTrue(dict['auth']['user']['username'],'username'); - self.assertTrue(dict['auth']['user']['tenantId'],'12345'); - self.assertTrue(dict['auth']['token']['id'],'2231312'); - self.assertTrue(dict['auth']['token']['expires'],date.today()); + self.assertTrue(dict['auth']['user']['username'], 'username'); + self.assertTrue(dict['auth']['user']['tenantId'], '12345'); + self.assertTrue(dict['auth']['token']['id'], '2231312'); + self.assertTrue(dict['auth']['token']['expires'], date.today()); def test_get_auth_token(self): - self.request.headers["X-Auth-Token"]="Test token" - self.assertTrue(server.get_auth_token(self.request),"Test Token") + self.request.headers["X-Auth-Token"] = "Test token" + self.assertTrue(utils.get_auth_token(self.request), "Test Token") def test_get_normalized_request_content_exception(self): - self.assertRaises(fault.IdentityFault,server.get_normalized_request_content,None,self.request) + self.assertRaises(fault.IdentityFault, utils.get_normalized_request_content, None, self.request) def test_get_normalized_request_content_xml(self): - self.request.environ["CONTENT_TYPE"]="application/xml" - pwd_cred = auth.PasswordCredentials("username","password","1") + self.request.environ["CONTENT_TYPE"] = "application/xml" + pwd_cred = auth.PasswordCredentials("username", "password", "1") body = ' \ ' - str=StringIO() + str = StringIO() str.write(body) - self.request.environ["wsgi.input"]=str + self.request.environ["wsgi.input"] = str self.request.environ["CONTENT_LENGTH"] = str.len #TODO: I THINK THIS belongs in a test for auth.py. if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() -- cgit From 428a893153478174bf73ad46d3e6952d2d3e7dbf Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 15 Jun 2011 16:11:40 -0500 Subject: Fixed error on UrlExtensionFilterTest --- keystone/test/unit/test_exthandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keystone/test/unit/test_exthandler.py b/keystone/test/unit/test_exthandler.py index 4379e03f..30a61f98 100644 --- a/keystone/test/unit/test_exthandler.py +++ b/keystone/test/unit/test_exthandler.py @@ -19,7 +19,7 @@ import sys # Need to access identity module sys.path.append(os.path.abspath(os.path.join( os.getcwd(), '..', '..', 'keystone'))) -from queryext.exthandler import UrlExtensionFilter +from keystone.queryext.exthandler import UrlExtensionFilter import unittest -- cgit