]> jfr.im git - z_archive/twitter.git/blobdiff - tests/test_sanity.py
Pass a method param to force post or get method.
[z_archive/twitter.git] / tests / test_sanity.py
index 742bd7a99f6af8d07859ed77b6cc1377a7e40ca0..0f2389c5456a1738c4378d8a9f40659c75622e18 100644 (file)
@@ -1,5 +1,7 @@
+# encoding: utf8
 
 from random import choice
+import time
 
 from twitter import Twitter, NoAuth, OAuth, read_token_file
 from twitter.cmdline import CONSUMER_KEY, CONSUMER_SECRET
@@ -29,6 +31,17 @@ def test_API_get_some_public_tweets():
 def test_API_set_tweet():
     random_tweet = "A random tweet " + get_random_str()
     twitter.statuses.update(status=random_tweet)
+    time.sleep(2)
+    recent = twitter.statuses.user_timeline()
+    assert recent
+    assert isinstance(recent.rate_limit_remaining, int)
+    assert isinstance(recent.rate_limit_reset, int)
+    assert random_tweet == recent[0]['text']
+
+
+def test_API_set_unicode_tweet():
+    random_tweet = u"A random tweet with unicode ⇰ÐÀ " + get_random_str()
+    twitter.statuses.update(status=random_tweet)
 
     recent = twitter.statuses.user_timeline()
     assert recent
@@ -46,3 +59,16 @@ def test_search():
     t_search = Twitter(domain='search.twitter.com')
     results = t_search.search(q='foo')
     assert results
+
+
+def test_get_trends():
+    # This is one method of inserting parameters, using named
+    # underscore params.
+    world_trends = twitter.trends._woeid(_woeid=1)
+    assert world_trends
+
+
+def test_get_trends_2():
+    # This is a nicer variation of the same call as above.
+    world_trends = twitter.trends._(1)
+    assert world_trends