self.assert_(isinstance(s[0],Status))
def testfriendstimeline(self):
- s = self.api.friends_timeline(count=5)
- self.assert_(len(s) == 5)
+ s = self.api.friends_timeline(count=1)
+ self.assert_(len(s) == 1)
self.assert_(isinstance(s[0],Status))
def testusertimeline(self):
self.assert_(isinstance(me,User))
self.assertEqual(me.screen_name, self.username)
+ def testfriends(self):
+ friends = self.api.friends()
+ self.assert_(len(friends) > 0)
+ self.assert_(isinstance(friends[0], User))
+
+ def testfollowers(self):
+ followers = self.api.followers()
+ self.assert_(len(followers) > 0)
+ self.assert_(isinstance(followers[0], User))
+
+ def testdirectmessages(self):
+ dms = self.api.direct_messages()
+ self.assert_(len(dms) > 0)
+ self.assert_(isinstance(dms[0], DirectMessage))
+
+ def testsenddirectmessage(self):
+ dm = self.api.send_direct_message(self.username, 'test message')
+ self.assert_(isinstance(dm, DirectMessage))
+ self.assertEqual(dm.text, 'test message')
+ self.assertEqual(dm.sender.screen_name, self.username)
+ self.assertEqual(dm.recipient.screen_name, self.username)
+
if __name__ == '__main__':
unittest.main()
dm = api.classes['direct_message']()
dm._api = api
for k,v in obj.items():
- if k == 'sender':
+ if k == 'sender' or k == 'recipient':
setattr(dm, k, _parse_user(v, api))
elif k == 'created_at':
setattr(dm, k, _parse_datetime(v))