diff options
| author | Ramana Juvvadi <rjuvvadi@hcl.com> | 2011-05-09 00:48:23 -0500 |
|---|---|---|
| committer | Ramana Juvvadi <rjuvvadi@hcl.com> | 2011-05-09 00:48:23 -0500 |
| commit | 3c53cee318c841e69cb4f81af5e8747e8bb34338 (patch) | |
| tree | bce6eaf07812fe8512b518e69c509a4d126efd25 | |
| parent | 0445554a1f1cf45bf8c3633c001fc290e30aba98 (diff) | |
corrects charset=utf=8
| -rw-r--r-- | test/unit/test_identity.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/test/unit/test_identity.py b/test/unit/test_identity.py index 0626181c..09170a79 100644 --- a/test/unit/test_identity.py +++ b/test/unit/test_identity.py @@ -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): @@ -244,9 +246,10 @@ class identity_test(unittest.TestCase): 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") @@ -254,8 +257,9 @@ class identity_test(unittest.TestCase): 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): @@ -276,13 +280,14 @@ class authorize_test(identity_test): 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") @@ -364,7 +369,7 @@ class validate_token(authorize_test): 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") @@ -378,7 +383,7 @@ class validate_token(authorize_test): 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") @@ -392,7 +397,7 @@ class validate_token(authorize_test): 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") @@ -408,7 +413,7 @@ class validate_token(authorize_test): 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") @@ -423,7 +428,7 @@ class validate_token(authorize_test): 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") @@ -437,7 +442,7 @@ class validate_token(authorize_test): 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): |
