Commit 1ff1ea7e authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Restructure repository layout. Fixed test errors.

parent 4d85f40c
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
import unittest import unittest
import random import random
from api import API from tweepy import *
from models import *
"""Unit tests""" """Unit tests"""
...@@ -19,7 +18,6 @@ class TweepyAPITests(unittest.TestCase): ...@@ -19,7 +18,6 @@ class TweepyAPITests(unittest.TestCase):
def setUp(self): def setUp(self):
self.api = API(self.username, self.password) self.api = API(self.username, self.password)
self.update_status_id = None
def testsetcredentials(self): def testsetcredentials(self):
testapi = API() testapi = API()
...@@ -53,21 +51,20 @@ class TweepyAPITests(unittest.TestCase): ...@@ -53,21 +51,20 @@ class TweepyAPITests(unittest.TestCase):
self.assert_(isinstance(s,Status)) self.assert_(isinstance(s,Status))
self.assertEqual(s.user.id, 17) self.assertEqual(s.user.id, 17)
def testupdatestatus(self): def testupdateanddestroystatus(self):
# test update
text = 'testing %i' % random.randint(0,1000) text = 'testing %i' % random.randint(0,1000)
update = self.api.update_status('status'=text) update = self.api.update_status(status=text)
self.assert_(isinstance(update,Status)) self.assert_(isinstance(update,Status))
self.assertEqual(update.text, text) self.assertEqual(update.text, text)
self.update_status_id = update.id
def testdestroystatus(self): # test destroy
self.assert_(self.update_status_id) deleted = self.api.destroy_status(id=update.id)
deleted = self.api.destroy_status(id=self.update_status_id)
self.assert_(isinstance(deleted,Status)) self.assert_(isinstance(deleted,Status))
self.assertEqual(deleted.id, self.update_status_id) self.assertEqual(deleted.id, update.id)
def testshowuser(self): def testgetuser(self):
u = self.api.show_user(screen_name='twitter') u = self.api.get_user(screen_name='twitter')
self.assert_(isinstance(u,User)) self.assert_(isinstance(u,User))
self.assertEqual(u.screen_name, 'twitter') self.assertEqual(u.screen_name, 'twitter')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment