def testWrite(self): api = Api(BLOG, USER, PASSWORD) newpost = api.write_regular('title', 'body') post = api.read(newpost['id']) assert newpost['id'] == post['id'] newpost = api.write_link('http://www.google.com') post = api.read(newpost['id']) assert newpost['id'] == post['id'] newpost = api.write_quote('it was the best of times...') post = api.read(newpost['id']) assert newpost['id'] == post['id'] newpost = api.write_conversation('me: wow\nyou: double wow!') post = api.read(newpost['id']) assert newpost['id'] == post['id'] newpost = api.write_video('http://www.youtube.com/watch?v=60og9gwKh1o') post = api.read(newpost['id']) assert newpost['id'] == post['id'] newpost = api.write_photo( 'http://www.google.com/intl/en_ALL/images/logo.gif') post = api.read(newpost['id']) assert newpost['id'] == post['id']
def testRead(self): api = Api(BLOG) freq = {} posts = api.read() total = 0 for post in posts: total += 1 type = post['type'] try: freq[type] += 1 except: freq[type] = 1 assert total > 0 for type in freq: assert self.countType(api,type) == freq[type]
def testRead(self): api = Api(BLOG) freq = {} posts = api.read() total = 0 for post in posts: total += 1 type = post['type'] try: freq[type] += 1 except: freq[type] = 1 assert total > 0 for type in freq: assert self.countType(api, type) == freq[type]
def testWrite(self): api = Api(BLOG, USER, PASSWORD) newpost = api.write_regular('title','body') post = api.read(newpost['id']) assert newpost['id'] == post['id']