From a4eb0aa2aced698a17aa7d4124b683450d7f45e5 Mon Sep 17 00:00:00 2001 From: jrconlin Date: Thu, 6 Jan 2011 21:17:19 -0800 Subject: [PATCH] Added additional tests --- python/OAuthSimple.py | 2 -- python/tests.py | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/python/OAuthSimple.py b/python/OAuthSimple.py index 1513fc0..7f1b969 100644 --- a/python/OAuthSimple.py +++ b/python/OAuthSimple.py @@ -157,8 +157,6 @@ class OAuthSimple: def _oauthEscape (self,string): if not string: return ''; - if type(string) not in [type(''),type(1)]: - raise OAuthSimpleException('Array passed to _oauthEscape') string = urllib2.quote(string); return string.replace('/','%2F').replace('+','%20').replace('!','%21').replace('*','%2A').replace('\\','%27').replace('(','%28').replace(')','%29') diff --git a/python/tests.py b/python/tests.py index eba7725..67a4df3 100644 --- a/python/tests.py +++ b/python/tests.py @@ -45,13 +45,19 @@ class TestOAuth(unittest.TestCase): content = json.loads(rsp.read()) self.assertTrue(content.get('catalog')[0].get('id') == u'http://api.netflix.com/catalog/titles/movies/60035973') + def testComplex(self): + self.o1.reset(); + self.o1.signatures(self.signatures); + self.o1.setPath(u'http://api.netflix.com/catalog/titles/movies/60035973'); + self.o1.setParameters({'expand':'all', + 'v':'2.0', + 'output':'json'}); + signed = self.o1.sign(); + content = json.loads(urllib2.urlopen(signed.get('signed_url')).read()) + # This is probably testing Netflix's API more than mine. + self.assertEqual(content['catalog_title']['directors'][0]['name'],u'Stewart Raffill') + if (__name__ == '__main__'): unittest.main() -## todo: -# finish test cases for: -### simple run -# partial run -# test remotely - \ No newline at end of file