mirror of
https://github.com/jrconlin/oauthsimple.git
synced 2026-09-14 10:33:00 +00:00
Added additional tests
This commit is contained in:
@@ -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')
|
||||
|
||||
+12
-6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user