summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSai Krishna <saikrishna1511@gmail.com>2011-05-16 19:49:18 +0530
committerSai Krishna <saikrishna1511@gmail.com>2011-05-16 19:49:18 +0530
commitcdacf853221f18ee3cb4d75f35a63f9da979a8fa (patch)
tree253982a030cc6679f7e11144085855c22a688393
parent2053f355faf44699afe15a6213db628b436b77a4 (diff)
downloadkeystone-cdacf853221f18ee3cb4d75f35a63f9da979a8fa.tar.gz
keystone-cdacf853221f18ee3cb4d75f35a63f9da979a8fa.tar.xz
keystone-cdacf853221f18ee3cb4d75f35a63f9da979a8fa.zip
Added as per HACKING Files
-rw-r--r--keystone/logic/types/auth.py7
-rw-r--r--test/unit/test_authentication.py18
-rw-r--r--test/unit/test_groups.py19
-rw-r--r--test/unit/test_keystone.py3
-rw-r--r--test/unit/test_users.py6
5 files changed, 27 insertions, 26 deletions
diff --git a/keystone/logic/types/auth.py b/keystone/logic/types/auth.py
index 726b4f95..4faaba05 100644
--- a/keystone/logic/types/auth.py
+++ b/keystone/logic/types/auth.py
@@ -13,9 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from datetime import datetime
-
from abc import ABCMeta
+from datetime import datetime
import json
from lxml import etree
@@ -50,12 +49,12 @@ class PasswordCredentials(object):
if password == None:
raise fault.BadRequestFault("Expecting a password")
tenant_id = root.get("tenantId")
-
+
#--for multi-token handling--
if tenant_id == None:
raise fault.BadRequestFault("Expecting tenant")
# ----
-
+
return PasswordCredentials(username, password, tenant_id)
except etree.LxmlError as e:
raise fault.BadRequestFault("Cannot parse password credentials",
diff --git a/test/unit/test_authentication.py b/test/unit/test_authentication.py
index 3946f1f3..75917417 100644
--- a/test/unit/test_authentication.py
+++ b/test/unit/test_authentication.py
@@ -1,13 +1,13 @@
+# Need to access identity module
+import httplib2
+import json
+from lxml import etree
import os
import sys
-# Need to access identity module
sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__),
'..', '..', '..', '..', 'keystone')))
import unittest
from webtest import TestApp
-import httplib2
-import json
-from lxml import etree
import test_common as utils
@@ -46,7 +46,7 @@ class AuthenticationTest(unittest.TestCase):
"tenantId" : self.tenant}}
resp, content = header.request(url, "POST", body=json.dumps(body),
headers={"Content-Type": "application/json"})
-
+
content = json.loads(content)
if int(resp['status']) == 500:
self.fail('IDM fault')
@@ -66,7 +66,7 @@ class AuthenticationTest(unittest.TestCase):
resp, content = header.request(url, "POST", body=body,
headers={"Content-Type": "application/xml",
"ACCEPT": "application/xml"})
-
+
content = etree.fromstring(content)
if int(resp['status']) == 500:
self.fail('IDM fault')
@@ -144,14 +144,14 @@ class MultiToken(unittest.TestCase):
self.assertNotEqual(token1, None)
self.assertNotEqual(token2, None)
self.assertNotEqual(token1, token2)
-
+
resp = utils.delete_token(token1, self.auth_token)
resp = utils.delete_token(token2, self.auth_token)
def test_unassigned_user(self):
resp, content = utils.get_token('test_user2', 'secrete', 'test_tenant2')
-
+
self.assertEqual(403, int(resp['status']))
-
+
if __name__ == '__main__':
unittest.main()
diff --git a/test/unit/test_groups.py b/test/unit/test_groups.py
index 8726c706..9c642ec1 100644
--- a/test/unit/test_groups.py
+++ b/test/unit/test_groups.py
@@ -1,16 +1,17 @@
+# Need to access identity module
+import httplib2
+import json
+from lxml import etree
import os
import sys
-# Need to access identity module
sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__),
'..', '..', '..', '..', 'keystone')))
import unittest
from webtest import TestApp
-import httplib2
-import json
-from lxml import etree
import test_common as utils
+
##
## Global Group Tests
##
@@ -575,19 +576,19 @@ class DeleteGlobalGroupTest(GlobalGroupTest):
def test_delete_global_group_xml(self):
resp, content = utils.create_tenant_xml(self.globaltenant,
str(self.auth_token))
-
+
resp_new, content_new = utils.create_tenant_group_xml(\
'test_global_group_delete',
self.globaltenant,
str(self.auth_token))
-
+
resp_new, content_new = utils.delete_global_group_xml(\
'test_global_group_delete',
str(self.auth_token))
-
+
resp = utils.delete_tenant_xml(self.globaltenant,
str(self.auth_token))
-
+
self.assertEqual(204, int(resp_new['status']))
@@ -700,7 +701,7 @@ class AddUserGlobalGroupTest(unittest.TestCase):
str(self.auth_token))
resp_new, content_new = utils.create_user(self.tenant, self.user,
str(self.auth_token))
-
+
resp_new, content_new = utils.add_user_global_group(self.global_group,
self.user,
str(self.token))
diff --git a/test/unit/test_keystone.py b/test/unit/test_keystone.py
index 9a6fe4df..035a5d4d 100644
--- a/test/unit/test_keystone.py
+++ b/test/unit/test_keystone.py
@@ -1,7 +1,8 @@
import logging
+from lxml import etree
import os
import unittest
-from lxml import etree
+
MODULE_EXTENSIONS = set('.py'.split())
TEST_FILES = ['test_authentication.py', 'test_keystone.py', 'test_tenants.py',
'test_common.py', 'test_users.py','test_tenant_groups.py',
diff --git a/test/unit/test_users.py b/test/unit/test_users.py
index 98d22397..1be4f598 100644
--- a/test/unit/test_users.py
+++ b/test/unit/test_users.py
@@ -3,10 +3,10 @@ import sys
# Need to access identity module
sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__),
'..', '..', '..', '..', 'keystone')))
-import unittest
import httplib2
import json
from lxml import etree
+import unittest
import test_common as utils
from test_common import URL
@@ -37,9 +37,9 @@ class UserTest(unittest.TestCase):
class CreateUserTest(UserTest):
def test_a_user_create_json(self):
-
+
resp = utils.delete_user(self.tenant, self.user, str(self.auth_token))
-
+
resp, content = utils.create_user(self.tenant, 'test_user1',
str(self.auth_token))
self.user = 'test_user1'