Skip to content

Commit

Permalink
corrects charset=utf=8
Browse files Browse the repository at this point in the history
  • Loading branch information
juvvadi committed May 9, 2011
1 parent 0445554 commit 3c53cee
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions test/unit/test_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def get_exp_auth_token():
def get_disabled_token():
return '999888777'

def content_type(resp):
return resp['content-type'].split(';')[0]

class identity_test(unittest.TestCase):

Expand All @@ -244,18 +246,20 @@ def test_a_get_version_json(self):
h = httplib2.Http(".cache")
url = URL
resp, content = h.request(url, "GET", body="",
headers={"Content-Type": "application/json"})
headers={"Content-Type": "application/json"})

self.assertEqual(200, int(resp['status']))
self.assertEqual('application/json', resp['content-type'])
self.assertEqual('application/json', content_type(resp))

def test_a_get_version_xml(self):
h = httplib2.Http(".cache")
url = URL
resp, content = h.request(url, "GET", body="",
headers={"Content-Type": "application/xml",
"ACCEPT": "application/xml"})

self.assertEqual(200, int(resp['status']))
self.assertEqual('application/xml', resp['content-type'])
self.assertEqual('application/xml', content_type(resp))


class authorize_test(identity_test):
Expand All @@ -276,13 +280,14 @@ def tearDown(self):

def test_a_authorize(self):
resp, content = get_token('joeuser', 'secrete')

self.assertEqual(200, int(resp['status']))
self.assertEqual('application/json', resp['content-type'])
self.assertEqual('application/json', content_type(resp))

def test_a_authorize_xml(self):
resp, content = get_token_xml('joeuser', 'secrete')
self.assertEqual(200, int(resp['status']))
self.assertEqual('application/xml', resp['content-type'])
self.assertEqual('application/xml', content_type(resp))

def test_a_authorize_user_disaabled(self):
h = httplib2.Http(".cache")
Expand Down Expand Up @@ -364,7 +369,7 @@ def test_validate_token_true(self):
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(200, int(resp['status']))
self.assertEqual('application/json', resp['content-type'])
self.assertEqual('application/json', content_type(resp))

def test_validate_token_true_xml(self):
h = httplib2.Http(".cache")
Expand All @@ -378,7 +383,7 @@ def test_validate_token_true_xml(self):
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(200, int(resp['status']))
self.assertEqual('application/xml', resp['content-type'])
self.assertEqual('application/xml', content_type(resp))

def test_validate_token_expired(self):
h = httplib2.Http(".cache")
Expand All @@ -392,7 +397,7 @@ def test_validate_token_expired(self):
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(401, int(resp['status']))
self.assertEqual('application/json', resp['content-type'])
self.assertEqual('application/json', content_type(resp))

def test_validate_token_expired_xml(self):
h = httplib2.Http(".cache")
Expand All @@ -408,7 +413,7 @@ def test_validate_token_expired_xml(self):
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(401, int(resp['status']))
self.assertEqual('application/xml', resp['content-type'])
self.assertEqual('application/xml', content_type(resp))

def test_validate_token_invalid(self):
h = httplib2.Http(".cache")
Expand All @@ -423,7 +428,7 @@ def test_validate_token_invalid(self):
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(404, int(resp['status']))
self.assertEqual('application/json', resp['content-type'])
self.assertEqual('application/json', content_type(resp))

def test_validate_token_invalid_xml(self):
h = httplib2.Http(".cache")
Expand All @@ -437,7 +442,7 @@ def test_validate_token_invalid_xml(self):
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(404, int(resp['status']))
self.assertEqual('application/json', resp['content-type'])
self.assertEqual('application/json', content_type(resp))


class tenant_test(unittest.TestCase):
Expand Down

0 comments on commit 3c53cee

Please sign in to comment.