Move all the raw tweets for tests into their own JSON files

Seems better to have the raw data as JSON, like it comes from the API,
then load it into python objects for each test.
This commit is contained in:
Phil Gyford 2017-10-11 18:27:53 +01:00
parent 5c55aa8844
commit 5a008e7e77
12 changed files with 1010 additions and 49 deletions

View file

@ -27,26 +27,3 @@ test_list_slug = os.environ.get('TEST_LIST_SLUG', 'team')
test_list_owner_screen_name = os.environ.get('TEST_LIST_OWNER_SCREEN_NAME',
'twitterapi')
test_tweet_object = {u'contributors': None, u'truncated': False, u'text': u'http://t.co/FCmXyI6VHd is a #cool site, lol! @mikehelmick shd #checkitout. Love, @__twython__ https://t.co/67pwRvY6z9 http://t.co/N6InAO4B71', u'in_reply_to_status_id': None, u'id': 349683012054683648, u'favorite_count': 0, u'source': u'web', u'retweeted': False, u'coordinates': None, u'entities': {u'symbols': [], u'user_mentions': [{u'id': 29251354, u'indices': [45, 57], u'id_str': u'29251354', u'screen_name': u'mikehelmick', u'name': u'Mike Helmick'}, {u'id': 1431865928, u'indices': [81, 93], u'id_str': u'1431865928', u'screen_name': u'__twython__', u'name': u'Twython'}], u'hashtags': [{u'indices': [28, 33], u'text': u'cool'}, {u'indices': [62, 73], u'text': u'checkitout'}], u'urls': [{u'url': u'http://t.co/FCmXyI6VHd', u'indices': [0, 22], u'expanded_url': u'http://google.com', u'display_url': u'google.com'}, {u'url': u'https://t.co/67pwRvY6z9', u'indices': [94, 117], u'expanded_url': u'https://github.com', u'display_url': u'github.com'}], u'media': [{u'id': 537884378513162240, u'id_str': u'537884378513162240', u'indices': [118, 140], u'media_url': u'http://pbs.twimg.com/media/B3by_g-CQAAhrO5.jpg', u'media_url_https': u'https://pbs.twimg.com/media/B3by_g-CQAAhrO5.jpg', u'url': u'http://t.co/N6InAO4B71', u'display_url': u'pic.twitter.com/N6InAO4B71', u'expanded_url': u'http://twitter.com/pingofglitch/status/537884380060844032/photo/1', u'type': u'photo', u'sizes': {u'large': {u'w': 1024, u'h': 640, u'resize': u'fit'}, u'thumb': {u'w': 150, u'h': 150, u'resize': u'crop'}, u'medium': {u'w': 600, u'h': 375, u'resize': u'fit'}, u'small': {u'w': 340, u'h': 212, u'resize': u'fit'}}}]}, u'in_reply_to_screen_name': None, u'id_str': u'349683012054683648', u'retweet_count': 0, u'in_reply_to_user_id': None, u'favorited': False, u'user': {u'follow_request_sent': False, u'profile_use_background_image': True, u'default_profile_image': True, u'id': 1431865928, u'verified': False, u'profile_text_color': u'333333', u'profile_image_url_https': u'https://si0.twimg.com/sticky/default_profile_images/default_profile_3_normal.png', u'profile_sidebar_fill_color': u'DDEEF6', u'entities': {u'description': {u'urls': []}}, u'followers_count': 1, u'profile_sidebar_border_color': u'C0DEED', u'id_str': u'1431865928', u'profile_background_color': u'3D3D3D', u'listed_count': 0, u'profile_background_image_url_https': u'https://si0.twimg.com/images/themes/theme1/bg.png', u'utc_offset': None, u'statuses_count': 2, u'description': u'', u'friends_count': 1, u'location': u'', u'profile_link_color': u'0084B4', u'profile_image_url': u'http://a0.twimg.com/sticky/default_profile_images/default_profile_3_normal.png', u'following': False, u'geo_enabled': False, u'profile_background_image_url': u'http://a0.twimg.com/images/themes/theme1/bg.png', u'screen_name': u'__twython__', u'lang': u'en', u'profile_background_tile': False, u'favourites_count': 0, u'name': u'Twython', u'notifications': False, u'url': None, u'created_at': u'Thu May 16 01:11:09 +0000 2013', u'contributors_enabled': False, u'time_zone': None, u'protected': False, u'default_profile': False, u'is_translator': False}, u'geo': None, u'in_reply_to_user_id_str': None, u'possibly_sensitive': False, u'lang': u'en', u'created_at': u'Wed Jun 26 00:18:21 +0000 2013', u'in_reply_to_status_id_str': None, u'place': None}
test_tweet_html = '<a href="http://t.co/FCmXyI6VHd" class="twython-url">google.com</a> is a <a href="https://twitter.com/search?q=%23cool" class="twython-hashtag">#cool</a> site, lol! <a href="https://twitter.com/mikehelmick" class="twython-mention">@mikehelmick</a> shd <a href="https://twitter.com/search?q=%23checkitout" class="twython-hashtag">#checkitout</a>. Love, <a href="https://twitter.com/__twython__" class="twython-mention">@__twython__</a> <a href="https://t.co/67pwRvY6z9" class="twython-url">github.com</a> <a href="http://t.co/N6InAO4B71" class="twython-media">pic.twitter.com/N6InAO4B71</a>'
test_tweet_symbols_object = {u'text': u'Some symbols: $AAPL and $PEP and $ANOTHER and $A.', u'contributors': None, u'geo': None, u'favorited': True, u'in_reply_to_user_id_str': None, u'user': {u'screen_name': u'philgyfordtest', u'name': u'Phil Gyford Test'}, u'in_reply_to_user_id': None, u'retweeted': False, u'coordinates': None, u'place': None, u'in_reply_to_status_id': None, u'lang': u'en', u'in_reply_to_status_id_str': None, u'truncated': False, u'retweet_count': 0, u'is_quote_status': False, u'id': 662694880657989632, u'id_str': u'662694880657989632', u'in_reply_to_screen_name': None, u'favorite_count': 1, u'entities': {u'hashtags': [], u'user_mentions': [], u'symbols': [{u'indices': [14, 19], u'text': u'AAPL'}, {u'indices': [24, 28], u'text': u'PEP'}, {u'indices': [46, 48], u'text': u'A'}], u'urls': []}, u'created_at': u'Fri Nov 06 18:15:46 +0000 2015', u'source': u'web'}
test_tweet_compat_object = {u'contributors': None, u'truncated': True, u'text': u"Say more about what's happening! Rolling out now: photos, videos, GIFs, polls, and Quote Tweets no longer count tow\u2026 https://t.co/SRmsuks2ru", u'is_quote_status': False, u'in_reply_to_status_id': None, u'id': 777915304261193728, u'favorite_count': 13856, u'source': u'<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>', u'retweeted': False, u'coordinates': None, u'entities': {u'symbols': [], u'user_mentions': [], u'hashtags': [], u'urls': [{u'url': u'https://t.co/SRmsuks2ru', u'indices': [117, 140], u'expanded_url': u'https://twitter.com/i/web/status/777915304261193728', u'display_url': u'twitter.com/i/web/status/7\u2026'}]}, u'in_reply_to_screen_name': None, u'id_str': u'777915304261193728', u'retweet_count': 14767, u'in_reply_to_user_id': None, u'favorited': False, u'user': {u'name': u'Twitter', u'screen_name': u'twitter'}, u'geo': None, u'in_reply_to_user_id_str': None, u'possibly_sensitive': False, u'possibly_sensitive_appealable': False, u'lang': u'en', u'created_at': u'Mon Sep 19 17:00:36 +0000 2016', u'in_reply_to_status_id_str': None, u'place': None}
test_tweet_extended_object = {u'full_text': u"Say more about what's happening! Rolling out now: photos, videos, GIFs, polls, and Quote Tweets no longer count toward your 140 characters. https://t.co/I9pUC0NdZC", u'truncated': False, u'is_quote_status': False, u'in_reply_to_status_id': None, u'id': 777915304261193728, u'favorite_count': 13856, u'contributors': None, u'source': u'<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>', u'retweeted': False, u'coordinates': None, u'entities': {u'symbols': [], u'user_mentions': [], u'hashtags': [], u'urls': [], u'media': [{u'expanded_url': u'https://twitter.com/twitter/status/777915304261193728/photo/1', u'sizes': {u'small': {u'h': 340, u'w': 340, u'resize': u'fit'}, u'large': {u'h': 700, u'w': 700, u'resize': u'fit'}, u'medium': {u'h': 600, u'w': 600, u'resize': u'fit'}, u'thumb': {u'h': 150, u'w': 150, u'resize': u'crop'}}, u'url': u'https://t.co/I9pUC0NdZC', u'media_url_https': u'https://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg', u'id_str': u'777914712382058496', u'indices': [140, 163], u'media_url': u'http://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg', u'type': u'photo', u'id': 777914712382058496, u'display_url': u'pic.twitter.com/I9pUC0NdZC'}]}, u'in_reply_to_screen_name': None, u'id_str': u'777915304261193728', u'display_text_range': [0, 139], u'retweet_count': 14767, u'in_reply_to_user_id': None, u'favorited': False, u'user': {u'follow_request_sent': False, u'has_extended_profile': False, u'profile_use_background_image': True, u'id': 783214, u'verified': True, u'profile_text_color': u'333333', u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/767879603977191425/29zfZY6I_normal.jpg', u'profile_sidebar_fill_color': u'F6F6F6', u'is_translator': False, u'geo_enabled': True, u'entities': {u'url': {u'urls': [{u'url': u'http://t.co/5iRhy7wTgu', u'indices': [0, 22], u'expanded_url': u'http://blog.twitter.com/', u'display_url': u'blog.twitter.com'}]}, u'description': {u'urls': [{u'url': u'https://t.co/qq1HEzvnrA', u'indices': [84, 107], u'expanded_url': u'http://support.twitter.com', u'display_url': u'support.twitter.com'}]}}, u'followers_count': 56827498, u'protected': False, u'location': u'San Francisco, CA', u'default_profile_image': False, u'id_str': u'783214', u'lang': u'en', u'utc_offset': -25200, u'statuses_count': 3161, u'description': u'Your official source for news, updates and tips from Twitter, Inc. Need help? Visit https://t.co/qq1HEzvnrA.', u'friends_count': 145, u'profile_link_color': u'226699', u'profile_image_url': u'http://pbs.twimg.com/profile_images/767879603977191425/29zfZY6I_normal.jpg', u'notifications': False, u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/657090062/l1uqey5sy82r9ijhke1i.png', u'profile_background_color': u'ACDED6', u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/783214/1471929200', u'profile_background_image_url': u'http://pbs.twimg.com/profile_background_images/657090062/l1uqey5sy82r9ijhke1i.png', u'name': u'Twitter', u'is_translation_enabled': False, u'profile_background_tile': True, u'favourites_count': 2332, u'screen_name': u'twitter', u'url': u'http://t.co/5iRhy7wTgu', u'created_at': u'Tue Feb 20 14:35:54 +0000 2007', u'contributors_enabled': False, u'time_zone': u'Pacific Time (US & Canada)', u'profile_sidebar_border_color': u'FFFFFF', u'default_profile': False, u'following': False, u'listed_count': 90445}, u'geo': None, u'in_reply_to_user_id_str': None, u'possibly_sensitive': False, u'possibly_sensitive_appealable': False, u'lang': u'en', u'created_at': u'Mon Sep 19 17:00:36 +0000 2016', u'in_reply_to_status_id_str': None, u'place': None, u'extended_entities': {u'media': [{u'expanded_url': u'https://twitter.com/twitter/status/777915304261193728/photo/1', u'display_url': u'pic.twitter.com/I9pUC0NdZC', u'url': u'https://t.co/I9pUC0NdZC', u'media_url_https': u'https://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg', u'video_info': {u'aspect_ratio': [1, 1], u'variants': [{u'url': u'https://pbs.twimg.com/tweet_video/Csu1TzEVMAAAEv7.mp4', u'bitrate': 0, u'content_type': u'video/mp4'}]}, u'id_str': u'777914712382058496', u'sizes': {u'small': {u'h': 340, u'w': 340, u'resize': u'fit'}, u'large': {u'h': 700, u'w': 700, u'resize': u'fit'}, u'medium': {u'h': 600, u'w': 600, u'resize': u'fit'}, u'thumb': {u'h': 150, u'w': 150, u'resize': u'crop'}}, u'indices': [140, 163], u'type': u'animated_gif', u'id': 777914712382058496, u'media_url': u'http://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg'}]}}
test_tweet_extended_html = 'Say more about what\'s happening! Rolling out now: photos, videos, GIFs, polls, and Quote Tweets no longer count toward your 140 characters.<span class="twython-tweet-suffix"> <a href="https://t.co/I9pUC0NdZC" class="twython-media">pic.twitter.com/I9pUC0NdZC</a></span>'
test_tweet_identical_urls = {u'entities': {u'hashtags': [], u'user_mentions': [], u'symbols': [], u'urls': [{u'display_url': u'buff.ly/2sEhrgO', u'expanded_url': u'http://buff.ly/2sEhrgO', u'indices': [42, 65], u'url': u'https://t.co/W0uArTMk9N'}, {u'display_url': u'buff.ly/2sEhrgO', u'expanded_url': u'http://buff.ly/2sEhrgO', u'indices': [101, 124], u'url': u'https://t.co/W0uArTMk9N'}]}, u'full_text': u'Use Cases, Trials and Making 5G a Reality https://t.co/W0uArTMk9N #5G #innovation via @5GWorldSeries https://t.co/W0uArTMk9N'}
test_tweet_reply = { u'display_text_range': [12,114], u'in_reply_to_status_id_str':u'742374355531923456', u'source':u'web', u'geo':None, u'full_text':u'@philgyford Here\u2019s a test tweet that goes on as much as possible and includes an image. Hi to my fans in testland! https://t.co/tzhyk2QWSr', u'extended_entities':{ u'media':[] }, u'id_str':u'300', u'in_reply_to_status_id':742374355531923456, u'id':300, u'in_reply_to_screen_name':u'philgyford', u'retweet_count':0, u'user':{ }, u'created_at':u'Mon Jun 13 15:48:06 +0000 2016', u'lang':u'en', u'favorite_count':0, u'coordinates':None, u'place':None, u'contributors':None, u'in_reply_to_user_id':12552, u'in_reply_to_user_id_str':u'12552', u'retweeted':False, u'favorited':False, u'truncated':False, u'entities':{ u'user_mentions':[ { u'id_str':u'12552', u'id':12552, u'screen_name':u'philgyford', u'name':u'Phil Gyford', u'indices':[ 0, 11 ] } ], u'media':[ ], u'hashtags':[ ], u'symbols':[ ], u'urls':[ ] }, u'is_quote_status':False, u'possibly_sensitive':False }
test_tweet_media = {'user': {'name': 'Phil Gyford', 'screen_name': 'philgyford'}, 'geo': {}, 'id': 905105588279013377, 'text': 'I made some D3.js charts showing the years covered by books in a series compared to their publishing dates https://t.co/2yUmmn3TOc https://t.co/OwNc6uJklg', 'entities': {'user_mentions': [], 'hashtags': [], 'media': [{'url': 'https://t.co/OwNc6uJklg', 'display_url': 'pic.twitter.com/OwNc6uJklg', 'media_url_https': 'https://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg', 'id': 905105571765944320, 'media_url': 'http://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg', 'sizes': [{'h': 256, 'w': 680, 'resize': 'fit'}, {'h': 376, 'w': 1000, 'resize': 'fit'}, {'h': 150, 'w': 150, 'resize': 'crop'}, {'h': 376, 'w': 1000, 'resize': 'fit'}, {'h': 376, 'w': 1000, 'resize': 'fit'}], 'indices': [131, 154], 'expanded_url': 'https://twitter.com/philgyford/status/905105588279013377/photo/1', 'id_str': '905105571765944320'}, {'url': 'https://t.co/OwNc6uJklg', 'display_url': 'pic.twitter.com/OwNc6uJklg', 'media_url_https': 'https://pbs.twimg.com/media/DI-UuQbXUAQ1WlR.jpg', 'id': 905105572529393668, 'media_url': 'http://pbs.twimg.com/media/DI-UuQbXUAQ1WlR.jpg', 'sizes': [{'h': 399, 'w': 1000, 'resize': 'fit'}, {'h': 271, 'w': 680, 'resize': 'fit'}, {'h': 399, 'w': 1000, 'resize': 'fit'}, {'h': 150, 'w': 150, 'resize': 'crop'}, {'h': 399, 'w': 1000, 'resize': 'fit'}], 'indices': [131, 154], 'expanded_url': 'https://twitter.com/philgyford/status/905105588279013377/photo/1', 'id_str': '905105572529393668'}, {'url': 'https://t.co/OwNc6uJklg', 'display_url': 'pic.twitter.com/OwNc6uJklg', 'media_url_https': 'https://pbs.twimg.com/media/DI-UuTIXcAA-t1_.jpg', 'id': 905105573255016448, 'media_url': 'http://pbs.twimg.com/media/DI-UuTIXcAA-t1_.jpg', 'sizes': [{'h': 287, 'w': 1000, 'resize': 'fit'}, {'h': 195, 'w': 680, 'resize': 'fit'}, {'h': 150, 'w': 150, 'resize': 'crop'}, {'h': 287, 'w': 1000, 'resize': 'fit'}, {'h': 287, 'w': 1000, 'resize': 'fit'}], 'indices': [131, 154], 'expanded_url': 'https://twitter.com/philgyford/status/905105588279013377/photo/1', 'id_str': '905105573255016448'}], 'urls': [{'display_url': 'gyford.com/phil/writing/2…', 'url': 'https://t.co/2yUmmn3TOc', 'indices': [107, 130], 'expanded_url': 'http://www.gyford.com/phil/writing/2017/09/05/book-series-charts.php'}]}, 'source': 'web', 'created_at': '2017-09-05 16:29:22 +0000', 'id_str': '905105588279013377'}
test_tweet_quoted = {u'contributors': None, u'truncated': False, u'text': u'Here\u2019s a quoted tweet. https://t.co/3neKzof0gT', u'is_quote_status': True, u'in_reply_to_status_id': None, u'id': 917706313785905157, u'favorite_count': 0, u'source': u'web', u'quoted_status_id': 917699069916729344, u'retweeted': False, u'coordinates': None, u'quoted_status': {u'contributors': None, u'truncated': False, u'text': u'The quoted tweet text.', u'is_quote_status': False, u'in_reply_to_status_id': None, u'id': 917699069916729344, u'favorite_count': 1, u'source': u'web', u'retweeted': False, u'coordinates': None, u'entities': {u'symbols': [], u'user_mentions': [], u'hashtags': [], u'urls': []}, u'in_reply_to_screen_name': None, u'in_reply_to_user_id': None, u'retweet_count': 0, u'id_str': u'917699069916729344', u'favorited': False, u'user': {u'screen_name': u'philgyford', u'name': u'Phil Gyford'}, u'geo': None, u'in_reply_to_user_id_str': None, u'lang': u'ht', u'created_at': u'Tue Oct 10 10:31:22 +0000 2017', u'in_reply_to_status_id_str': None, u'place': None}, u'entities': {u'symbols': [], u'user_mentions': [], u'hashtags': [], u'urls': [{u'url': u'https://t.co/3neKzof0gT', u'indices': [23, 46], u'expanded_url': u'https://twitter.com/philgyford/status/917699069916729344', u'display_url': u'twitter.com/philgyford/sta\u2026'}]}, u'in_reply_to_screen_name': None, u'in_reply_to_user_id': None, u'retweet_count': 0, u'id_str': u'917706313785905157', u'favorited': False, u'user': {u'screen_name': u'philgyfordtest', u'name': u'Phil Gyford Test'}, u'geo': None, u'in_reply_to_user_id_str': None, u'possibly_sensitive': False, u'possibly_sensitive_appealable': False, u'lang': u'en', u'created_at': u'Tue Oct 10 11:00:10 +0000 2017', u'quoted_status_id_str': u'917699069916729344', u'in_reply_to_status_id_str': None, u'place': None}
test_tweet_retweet = {'coordinates': None, 'source': 'web', 'in_reply_to_user_id_str': None, 'truncated': False, 'in_reply_to_user_id': None, 'favorite_count': 0, 'user': {'name': 'Phil Gyford Test', 'screen_name': 'philgyfordtest'}, 'favorited': False, 'retweeted_status': {'coordinates': None, 'source': 'web', 'in_reply_to_user_id_str': None, 'truncated': False, 'in_reply_to_user_id': None, 'favorite_count': 21, 'user': {'name': 'Samuel Pepys', 'screen_name': 'samuelpepys'}, 'favorited': False, 'id': 917459832885653506, 'contributors': None, 'in_reply_to_screen_name': None, 'geo': None, 'in_reply_to_status_id_str': None, 'id_str': '917459832885653506', 'entities': {'hashtags': [], 'symbols': [], 'user_mentions': [], 'urls': []}, 'in_reply_to_status_id': None, 'text': 'My aunt and uncle in a very ill humour one with another, but I made shift with much ado to keep them from scolding.', 'retweet_count': 3, 'place': None, 'lang': 'en', 'created_at': 'Mon Oct 09 18:40:44 +0000 2017', 'is_quote_status': False, 'retweeted': False}, 'id': 917712989649801216, 'contributors': None, 'in_reply_to_screen_name': None, 'geo': None, 'in_reply_to_status_id_str': None, 'id_str': '917712989649801216', 'entities': {'hashtags': [], 'symbols': [], 'user_mentions': [{'id_str': '14475268', 'indices': [3, 15], 'name': 'Samuel Pepys', 'id': 14475268, 'screen_name': 'samuelpepys'}], 'urls': []}, 'in_reply_to_status_id': None, 'text': 'RT @samuelpepys: My aunt and uncle in a very ill humour one with another, but I made shift with much ado to keep them from scolding.', 'retweet_count': 3, 'place': None, 'lang': 'en', 'created_at': 'Tue Oct 10 11:26:41 +0000 2017', 'is_quote_status': False, 'retweeted': False}

View file

@ -4,7 +4,7 @@ from .config import (
app_key, app_secret, oauth_token, oauth_token_secret,
protected_twitter_1, protected_twitter_2, screen_name,
test_tweet_id, test_list_slug, test_list_owner_screen_name,
access_token, test_tweet_object, test_tweet_html, unittest
access_token, unittest
)
import time

View file

@ -1,98 +1,110 @@
# -*- coding: utf-8 -*-
import json
from twython import Twython, TwythonError
from .config import (
test_tweet_object, test_tweet_html, test_tweet_symbols_object,
test_tweet_compat_object, test_tweet_extended_object,
test_tweet_extended_html, test_tweet_identical_urls, test_tweet_reply,
test_tweet_media, test_tweet_quoted, test_tweet_retweet,
unittest
)
from .config import unittest
class TestHtmlForTweetTestCase(unittest.TestCase):
def setUp(self):
self.api = Twython('', '', '', '')
def load_tweet(self, name):
f = open('tests/tweets/%s.json' % name)
tweet = json.load(f)
f.close()
return tweet
def test_basic(self):
"""Test HTML for Tweet returns what we want"""
tweet_text = self.api.html_for_tweet(test_tweet_object)
self.assertEqual(test_tweet_html, tweet_text)
tweet_object = self.load_tweet('basic')
tweet_text = self.api.html_for_tweet(tweet_object)
self.assertEqual(tweet_text,
'<a href="http://t.co/FCmXyI6VHd" class="twython-url">google.com</a> is a <a href="https://twitter.com/search?q=%23cool" class="twython-hashtag">#cool</a> site, lol! <a href="https://twitter.com/mikehelmick" class="twython-mention">@mikehelmick</a> shd <a href="https://twitter.com/search?q=%23checkitout" class="twython-hashtag">#checkitout</a>. Love, <a href="https://twitter.com/__twython__" class="twython-mention">@__twython__</a> <a href="https://t.co/67pwRvY6z9" class="twython-url">github.com</a> <a href="http://t.co/N6InAO4B71" class="twython-media">pic.twitter.com/N6InAO4B71</a>')
def test_reply(self):
"""Test HTML for Tweet links the replied-to username."""
tweet_text = self.api.html_for_tweet(test_tweet_reply)
tweet_object = self.load_tweet('reply')
tweet_text = self.api.html_for_tweet(tweet_object)
self.assertEqual(tweet_text,
u'<span class="twython-tweet-prefix"><a href="https://twitter.com/philgyford" class="twython-mention">@philgyford</a> </span>Heres a test tweet that goes on as much as possible and includes an image. Hi to my fans in testland!<span class="twython-tweet-suffix"> https://t.co/tzhyk2QWSr</span>')
def test_expanded_url(self):
"""Test using expanded url in HTML for Tweet displays full urls"""
tweet_text = self.api.html_for_tweet(test_tweet_object,
tweet_object = self.load_tweet('basic')
tweet_text = self.api.html_for_tweet(tweet_object,
use_expanded_url=True)
# Make sure full url is in HTML
self.assertTrue('http://google.com' in tweet_text)
def test_short_url(self):
"""Test using expanded url in HTML for Tweet displays full urls"""
tweet_text = self.api.html_for_tweet(test_tweet_object, False)
tweet_object = self.load_tweet('basic')
tweet_text = self.api.html_for_tweet(tweet_object, False)
# Make sure HTML doesn't contain the display OR expanded url
self.assertTrue('http://google.com' not in tweet_text)
self.assertTrue('google.com' not in tweet_text)
def test_identical_urls(self):
"""If the 'url's for different url entities are identical, they should link correctly."""
tweet_text = self.api.html_for_tweet(test_tweet_identical_urls)
tweet_object = self.load_tweet('identical_urls')
tweet_text = self.api.html_for_tweet(tweet_object)
self.assertEqual(tweet_text,
u'Use Cases, Trials and Making 5G a Reality <a href="https://t.co/W0uArTMk9N" class="twython-url">buff.ly/2sEhrgO</a> #5G #innovation via @5GWorldSeries <a href="https://t.co/W0uArTMk9N" class="twython-url">buff.ly/2sEhrgO</a>')
def test_symbols(self):
tweet_text = self.api.html_for_tweet(test_tweet_symbols_object)
tweet_object = self.load_tweet('symbols')
tweet_text = self.api.html_for_tweet(tweet_object)
# Should only link symbols listed in entities:
self.assertTrue('<a href="https://twitter.com/search?q=%24AAPL" class="twython-symbol">$AAPL</a>' in tweet_text)
self.assertTrue('<a href="https://twitter.com/search?q=%24ANOTHER" class="twython-symbol">$ANOTHER</a>' not in tweet_text)
def test_no_symbols(self):
"""Should still work if tweet object has no symbols list"""
tweet = test_tweet_symbols_object
tweet = self.load_tweet('symbols')
# Save a copy:
symbols = tweet['entities']['symbols']
del tweet['entities']['symbols']
tweet_text = self.api.html_for_tweet(tweet)
self.assertTrue('symbols: $AAPL and' in tweet_text)
self.assertTrue('and $ANOTHER and $A.' in tweet_text)
# Put the symbols back:
test_tweet_symbols_object['entities']['symbols'] = symbols
def test_compatmode(self):
tweet_text = self.api.html_for_tweet(test_tweet_compat_object)
tweet_object = self.load_tweet('compat')
tweet_text = self.api.html_for_tweet(tweet_object)
# link to compat web status link
self.assertTrue(
u'<a href="https://t.co/SRmsuks2ru" class="twython-url">twitter.com/i/web/status/7…</a>' in tweet_text)
def test_extendedmode(self):
tweet_text = self.api.html_for_tweet(test_tweet_extended_object)
tweet_object = self.load_tweet('extended')
tweet_text = self.api.html_for_tweet(tweet_object)
# full tweet rendered with suffix
self.assertEqual(test_tweet_extended_html, tweet_text)
self.assertEqual(tweet_text,
'Say more about what\'s happening! Rolling out now: photos, videos, GIFs, polls, and Quote Tweets no longer count toward your 140 characters.<span class="twython-tweet-suffix"> <a href="https://t.co/I9pUC0NdZC" class="twython-media">pic.twitter.com/I9pUC0NdZC</a></span>')
def test_media(self):
tweet_text = self.api.html_for_tweet(test_tweet_media)
tweet_object = self.load_tweet('media')
tweet_text = self.api.html_for_tweet(tweet_object)
self.assertEqual(
"""I made some D3.js charts showing the years covered by books in a series compared to their publishing dates <a href="https://t.co/2yUmmn3TOc" class="twython-url">gyford.com/phil/writing/2…</a> <a href="https://t.co/OwNc6uJklg" class="twython-media">pic.twitter.com/OwNc6uJklg</a>""",
u"""I made some D3.js charts showing the years covered by books in a series compared to their publishing dates <a href="https://t.co/2yUmmn3TOc" class="twython-url">gyford.com/phil/writing/2\u2026</a><span class="twython-tweet-suffix"> <a href="https://t.co/OwNc6uJklg" class="twython-media">pic.twitter.com/OwNc6uJklg</a></span>""",
tweet_text)
def test_quoted(self):
"With expand_quoted_status=True it should include a quoted tweet."
tweet_text = self.api.html_for_tweet(test_tweet_quoted,
tweet_object = self.load_tweet('quoted')
tweet_text = self.api.html_for_tweet(tweet_object,
expand_quoted_status=True)
self.assertEqual(
u"""Here\u2019s a quoted tweet. <a href="https://t.co/3neKzof0gT" class="twython-url">twitter.com/philgyford/sta\u2026</a><blockquote class="twython-quote">The quoted tweet text.<cite><a href="https://twitter.com/philgyford/status/917699069916729344"><span class="twython-quote-user-name">Phil Gyford</span><span class="twython-quote-user-screenname">@philgyford</span></a></cite></blockquote>""",
tweet_text)
def test_retweet(self):
"With expand_quoted_status=True it should include a quoted tweet."
tweet_text = self.api.html_for_tweet(test_tweet_retweet)
tweet_object = self.load_tweet('retweet')
tweet_text = self.api.html_for_tweet(tweet_object)
self.assertEqual(
u"""My aunt and uncle in a very ill humour one with another, but I made shift with much ado to keep them from scolding.""",

170
tests/tweets/basic.json Normal file
View file

@ -0,0 +1,170 @@
{
"contributors":null,
"truncated":false,
"text":"http://t.co/FCmXyI6VHd is a #cool site, lol! @mikehelmick shd #checkitout. Love, @__twython__ https://t.co/67pwRvY6z9 http://t.co/N6InAO4B71",
"in_reply_to_status_id":null,
"id":349683012054683648,
"favorite_count":0,
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"retweeted":false,
"coordinates":null,
"entities":{
"symbols":[
],
"user_mentions":[
{
"id":29251354,
"indices":[
45,
57
],
"id_str":"29251354",
"screen_name":"mikehelmick",
"name":"Mike Helmick"
},
{
"id":1431865928,
"indices":[
81,
93
],
"id_str":"1431865928",
"screen_name":"__twython__",
"name":"Twython"
}
],
"hashtags":[
{
"indices":[
28,
33
],
"text":"cool"
},
{
"indices":[
62,
73
],
"text":"checkitout"
}
],
"urls":[
{
"url":"http://t.co/FCmXyI6VHd",
"indices":[
0,
22
],
"expanded_url":"http://google.com",
"display_url":"google.com"
},
{
"url":"https://t.co/67pwRvY6z9",
"indices":[
94,
117
],
"expanded_url":"https://github.com",
"display_url":"github.com"
}
],
"media":[
{
"id":537884378513162240,
"id_str":"537884378513162240",
"indices":[
118,
140
],
"media_url":"http://pbs.twimg.com/media/B3by_g-CQAAhrO5.jpg",
"media_url_https":"https://pbs.twimg.com/media/B3by_g-CQAAhrO5.jpg",
"url":"http://t.co/N6InAO4B71",
"display_url":"pic.twitter.com/N6InAO4B71",
"expanded_url":"http://twitter.com/pingofglitch/status/537884380060844032/photo/1",
"type":"photo",
"sizes":{
"large":{
"w":1024,
"h":640,
"resize":"fit"
},
"thumb":{
"w":150,
"h":150,
"resize":"crop"
},
"medium":{
"w":600,
"h":375,
"resize":"fit"
},
"small":{
"w":340,
"h":212,
"resize":"fit"
}
}
}
]
},
"in_reply_to_screen_name":null,
"id_str":"349683012054683648",
"retweet_count":0,
"in_reply_to_user_id":null,
"favorited":false,
"user":{
"follow_request_sent":false,
"profile_use_background_image":true,
"default_profile_image":true,
"id":1431865928,
"verified":false,
"profile_text_color":"333333",
"profile_image_url_https":"https://si0.twimg.com/sticky/default_profile_images/default_profile_3_normal.png",
"profile_sidebar_fill_color":"DDEEF6",
"entities":{
"description":{
"urls":[
]
}
},
"followers_count":1,
"profile_sidebar_border_color":"C0DEED",
"id_str":"1431865928",
"profile_background_color":"3D3D3D",
"listed_count":0,
"profile_background_image_url_https":"https://si0.twimg.com/images/themes/theme1/bg.png",
"utc_offset":null,
"statuses_count":2,
"description":"",
"friends_count":1,
"location":"",
"profile_link_color":"0084B4",
"profile_image_url":"http://a0.twimg.com/sticky/default_profile_images/default_profile_3_normal.png",
"following":false,
"geo_enabled":false,
"profile_background_image_url":"http://a0.twimg.com/images/themes/theme1/bg.png",
"screen_name":"__twython__",
"lang":"en",
"profile_background_tile":false,
"favourites_count":0,
"name":"Twython",
"notifications":false,
"url":null,
"created_at":"Thu May 16 01:11:09 +0000 2013",
"contributors_enabled":false,
"time_zone":null,
"protected":false,
"default_profile":false,
"is_translator":false
},
"geo":null,
"in_reply_to_user_id_str":null,
"possibly_sensitive":false,
"lang":"en",
"created_at":"Wed Jun 26 00:18:21 +0000 2013",
"in_reply_to_status_id_str":null,
"place":null
}

51
tests/tweets/compat.json Normal file
View file

@ -0,0 +1,51 @@
{
"contributors":null,
"truncated":true,
"text":"Say more about what's happening! Rolling out now: photos, videos, GIFs, polls, and Quote Tweets no longer count tow\u2026 https://t.co/SRmsuks2ru",
"is_quote_status":false,
"in_reply_to_status_id":null,
"id":777915304261193728,
"favorite_count":13856,
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"retweeted":false,
"coordinates":null,
"entities":{
"symbols":[
],
"user_mentions":[
],
"hashtags":[
],
"urls":[
{
"url":"https://t.co/SRmsuks2ru",
"indices":[
117,
140
],
"expanded_url":"https://twitter.com/i/web/status/777915304261193728",
"display_url":"twitter.com/i/web/status/7\u2026"
}
]
},
"in_reply_to_screen_name":null,
"id_str":"777915304261193728",
"retweet_count":14767,
"in_reply_to_user_id":null,
"favorited":false,
"user":{
"name":"Twitter",
"screen_name":"twitter"
},
"geo":null,
"in_reply_to_user_id_str":null,
"possibly_sensitive":false,
"possibly_sensitive_appealable":false,
"lang":"en",
"created_at":"Mon Sep 19 17:00:36 +0000 2016",
"in_reply_to_status_id_str":null,
"place":null
}

204
tests/tweets/extended.json Normal file
View file

@ -0,0 +1,204 @@
{
"full_text":"Say more about what's happening! Rolling out now: photos, videos, GIFs, polls, and Quote Tweets no longer count toward your 140 characters. https://t.co/I9pUC0NdZC",
"truncated":false,
"is_quote_status":false,
"in_reply_to_status_id":null,
"id":777915304261193728,
"favorite_count":13856,
"contributors":null,
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"retweeted":false,
"coordinates":null,
"entities":{
"symbols":[
],
"user_mentions":[
],
"hashtags":[
],
"urls":[
],
"media":[
{
"expanded_url":"https://twitter.com/twitter/status/777915304261193728/photo/1",
"sizes":{
"small":{
"h":340,
"w":340,
"resize":"fit"
},
"large":{
"h":700,
"w":700,
"resize":"fit"
},
"medium":{
"h":600,
"w":600,
"resize":"fit"
},
"thumb":{
"h":150,
"w":150,
"resize":"crop"
}
},
"url":"https://t.co/I9pUC0NdZC",
"media_url_https":"https://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg",
"id_str":"777914712382058496",
"indices":[
140,
163
],
"media_url":"http://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg",
"type":"photo",
"id":777914712382058496,
"display_url":"pic.twitter.com/I9pUC0NdZC"
}
]
},
"in_reply_to_screen_name":null,
"id_str":"777915304261193728",
"display_text_range":[
0,
139
],
"retweet_count":14767,
"in_reply_to_user_id":null,
"favorited":false,
"user":{
"follow_request_sent":false,
"has_extended_profile":false,
"profile_use_background_image":true,
"id":783214,
"verified":true,
"profile_text_color":"333333",
"profile_image_url_https":"https://pbs.twimg.com/profile_images/767879603977191425/29zfZY6I_normal.jpg",
"profile_sidebar_fill_color":"F6F6F6",
"is_translator":false,
"geo_enabled":true,
"entities":{
"url":{
"urls":[
{
"url":"http://t.co/5iRhy7wTgu",
"indices":[
0,
22
],
"expanded_url":"http://blog.twitter.com/",
"display_url":"blog.twitter.com"
}
]
},
"description":{
"urls":[
{
"url":"https://t.co/qq1HEzvnrA",
"indices":[
84,
107
],
"expanded_url":"http://support.twitter.com",
"display_url":"support.twitter.com"
}
]
}
},
"followers_count":56827498,
"protected":false,
"location":"San Francisco, CA",
"default_profile_image":false,
"id_str":"783214",
"lang":"en",
"utc_offset":-25200,
"statuses_count":3161,
"description":"Your official source for news, updates and tips from Twitter, Inc. Need help? Visit https://t.co/qq1HEzvnrA.",
"friends_count":145,
"profile_link_color":"226699",
"profile_image_url":"http://pbs.twimg.com/profile_images/767879603977191425/29zfZY6I_normal.jpg",
"notifications":false,
"profile_background_image_url_https":"https://pbs.twimg.com/profile_background_images/657090062/l1uqey5sy82r9ijhke1i.png",
"profile_background_color":"ACDED6",
"profile_banner_url":"https://pbs.twimg.com/profile_banners/783214/1471929200",
"profile_background_image_url":"http://pbs.twimg.com/profile_background_images/657090062/l1uqey5sy82r9ijhke1i.png",
"name":"Twitter",
"is_translation_enabled":false,
"profile_background_tile":true,
"favourites_count":2332,
"screen_name":"twitter",
"url":"http://t.co/5iRhy7wTgu",
"created_at":"Tue Feb 20 14:35:54 +0000 2007",
"contributors_enabled":false,
"time_zone":"Pacific Time (US & Canada)",
"profile_sidebar_border_color":"FFFFFF",
"default_profile":false,
"following":false,
"listed_count":90445
},
"geo":null,
"in_reply_to_user_id_str":null,
"possibly_sensitive":false,
"possibly_sensitive_appealable":false,
"lang":"en",
"created_at":"Mon Sep 19 17:00:36 +0000 2016",
"in_reply_to_status_id_str":null,
"place":null,
"extended_entities":{
"media":[
{
"expanded_url":"https://twitter.com/twitter/status/777915304261193728/photo/1",
"display_url":"pic.twitter.com/I9pUC0NdZC",
"url":"https://t.co/I9pUC0NdZC",
"media_url_https":"https://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg",
"video_info":{
"aspect_ratio":[
1,
1
],
"variants":[
{
"url":"https://pbs.twimg.com/tweet_video/Csu1TzEVMAAAEv7.mp4",
"bitrate":0,
"content_type":"video/mp4"
}
]
},
"id_str":"777914712382058496",
"sizes":{
"small":{
"h":340,
"w":340,
"resize":"fit"
},
"large":{
"h":700,
"w":700,
"resize":"fit"
},
"medium":{
"h":600,
"w":600,
"resize":"fit"
},
"thumb":{
"h":150,
"w":150,
"resize":"crop"
}
},
"indices":[
140,
163
],
"type":"animated_gif",
"id":777914712382058496,
"media_url":"http://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg"
}
]
}
}

View file

@ -0,0 +1,34 @@
{
"entities":{
"hashtags":[
],
"user_mentions":[
],
"symbols":[
],
"urls":[
{
"display_url":"buff.ly/2sEhrgO",
"expanded_url":"http://buff.ly/2sEhrgO",
"indices":[
42,
65
],
"url":"https://t.co/W0uArTMk9N"
},
{
"display_url":"buff.ly/2sEhrgO",
"expanded_url":"http://buff.ly/2sEhrgO",
"indices":[
101,
124
],
"url":"https://t.co/W0uArTMk9N"
}
]
},
"full_text":"Use Cases, Trials and Making 5G a Reality https://t.co/W0uArTMk9N #5G #innovation via @5GWorldSeries https://t.co/W0uArTMk9N"
}

205
tests/tweets/media.json Normal file
View file

@ -0,0 +1,205 @@
{
"contributors":null,
"truncated":false,
"is_quote_status":false,
"in_reply_to_status_id":null,
"id":905105588279013377,
"favorite_count":10,
"full_text":"I made some D3.js charts showing the years covered by books in a series compared to their publishing dates https://t.co/2yUmmn3TOc https://t.co/OwNc6uJklg",
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"retweeted":false,
"coordinates":null,
"entities":{
"symbols":[
],
"user_mentions":[
],
"hashtags":[
],
"urls":[
{
"url":"https://t.co/2yUmmn3TOc",
"indices":[
107,
130
],
"expanded_url":"http://www.gyford.com/phil/writing/2017/09/05/book-series-charts.php",
"display_url":"gyford.com/phil/writing/2\u2026"
}
],
"media":[
{
"expanded_url":"https://twitter.com/philgyford/status/905105588279013377/photo/1",
"display_url":"pic.twitter.com/OwNc6uJklg",
"url":"https://t.co/OwNc6uJklg",
"media_url_https":"https://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg",
"id_str":"905105571765944320",
"sizes":{
"small":{
"h":256,
"resize":"fit",
"w":680
},
"large":{
"h":376,
"resize":"fit",
"w":1000
},
"medium":{
"h":376,
"resize":"fit",
"w":1000
},
"thumb":{
"h":150,
"resize":"crop",
"w":150
}
},
"indices":[
131,
154
],
"type":"photo",
"id":905105571765944320,
"media_url":"http://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg"
}
]
},
"in_reply_to_screen_name":null,
"in_reply_to_user_id":null,
"display_text_range":[
0,
130
],
"retweet_count":1,
"id_str":"905105588279013377",
"favorited":false,
"user":{
"screen_name":"philgyford",
"name":"Phil Gyford"
},
"geo":null,
"in_reply_to_user_id_str":null,
"possibly_sensitive":false,
"possibly_sensitive_appealable":false,
"lang":"en",
"created_at":"Tue Sep 05 16:29:22 +0000 2017",
"in_reply_to_status_id_str":null,
"place":null,
"extended_entities":{
"media":[
{
"expanded_url":"https://twitter.com/philgyford/status/905105588279013377/photo/1",
"display_url":"pic.twitter.com/OwNc6uJklg",
"url":"https://t.co/OwNc6uJklg",
"media_url_https":"https://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg",
"id_str":"905105571765944320",
"sizes":{
"small":{
"h":256,
"resize":"fit",
"w":680
},
"large":{
"h":376,
"resize":"fit",
"w":1000
},
"medium":{
"h":376,
"resize":"fit",
"w":1000
},
"thumb":{
"h":150,
"resize":"crop",
"w":150
}
},
"indices":[
131,
154
],
"type":"photo",
"id":905105571765944320,
"media_url":"http://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg"
},
{
"expanded_url":"https://twitter.com/philgyford/status/905105588279013377/photo/1",
"display_url":"pic.twitter.com/OwNc6uJklg",
"url":"https://t.co/OwNc6uJklg",
"media_url_https":"https://pbs.twimg.com/media/DI-UuQbXUAQ1WlR.jpg",
"id_str":"905105572529393668",
"sizes":{
"large":{
"h":399,
"resize":"fit",
"w":1000
},
"small":{
"h":271,
"resize":"fit",
"w":680
},
"medium":{
"h":399,
"resize":"fit",
"w":1000
},
"thumb":{
"h":150,
"resize":"crop",
"w":150
}
},
"indices":[
131,
154
],
"type":"photo",
"id":905105572529393668,
"media_url":"http://pbs.twimg.com/media/DI-UuQbXUAQ1WlR.jpg"
},
{
"expanded_url":"https://twitter.com/philgyford/status/905105588279013377/photo/1",
"display_url":"pic.twitter.com/OwNc6uJklg",
"url":"https://t.co/OwNc6uJklg",
"media_url_https":"https://pbs.twimg.com/media/DI-UuTIXcAA-t1_.jpg",
"id_str":"905105573255016448",
"sizes":{
"small":{
"h":195,
"resize":"fit",
"w":680
},
"large":{
"h":287,
"resize":"fit",
"w":1000
},
"medium":{
"h":287,
"resize":"fit",
"w":1000
},
"thumb":{
"h":150,
"resize":"crop",
"w":150
}
},
"indices":[
131,
154
],
"type":"photo",
"id":905105573255016448,
"media_url":"http://pbs.twimg.com/media/DI-UuTIXcAA-t1_.jpg"
}
]
}
}

94
tests/tweets/quoted.json Normal file
View file

@ -0,0 +1,94 @@
{
"contributors":null,
"truncated":false,
"text":"Here\u2019s a quoted tweet. https://t.co/3neKzof0gT",
"is_quote_status":true,
"in_reply_to_status_id":null,
"id":917706313785905157,
"favorite_count":0,
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"quoted_status_id":917699069916729344,
"retweeted":false,
"coordinates":null,
"quoted_status":{
"contributors":null,
"truncated":false,
"text":"The quoted tweet text.",
"is_quote_status":false,
"in_reply_to_status_id":null,
"id":917699069916729344,
"favorite_count":1,
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"retweeted":false,
"coordinates":null,
"entities":{
"symbols":[
],
"user_mentions":[
],
"hashtags":[
],
"urls":[
]
},
"in_reply_to_screen_name":null,
"in_reply_to_user_id":null,
"retweet_count":0,
"id_str":"917699069916729344",
"favorited":false,
"user":{
"screen_name":"philgyford",
"name":"Phil Gyford"
},
"geo":null,
"in_reply_to_user_id_str":null,
"lang":"ht",
"created_at":"Tue Oct 10 10:31:22 +0000 2017",
"in_reply_to_status_id_str":null,
"place":null
},
"entities":{
"symbols":[
],
"user_mentions":[
],
"hashtags":[
],
"urls":[
{
"url":"https://t.co/3neKzof0gT",
"indices":[
23,
46
],
"expanded_url":"https://twitter.com/philgyford/status/917699069916729344",
"display_url":"twitter.com/philgyford/sta\u2026"
}
]
},
"in_reply_to_screen_name":null,
"in_reply_to_user_id":null,
"retweet_count":0,
"id_str":"917706313785905157",
"favorited":false,
"user":{
"screen_name":"philgyfordtest",
"name":"Phil Gyford Test"
},
"geo":null,
"in_reply_to_user_id_str":null,
"possibly_sensitive":false,
"possibly_sensitive_appealable":false,
"lang":"en",
"created_at":"Tue Oct 10 11:00:10 +0000 2017",
"quoted_status_id_str":"917699069916729344",
"in_reply_to_status_id_str":null,
"place":null
}

62
tests/tweets/reply.json Normal file
View file

@ -0,0 +1,62 @@
{
"display_text_range":[
12,
114
],
"in_reply_to_status_id_str":"742374355531923456",
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"geo":null,
"full_text":"@philgyford Here\u2019s a test tweet that goes on as much as possible and includes an image. Hi to my fans in testland! https://t.co/tzhyk2QWSr",
"extended_entities":{
"media":[
]
},
"id_str":"300",
"in_reply_to_status_id":742374355531923456,
"id":300,
"in_reply_to_screen_name":"philgyford",
"retweet_count":0,
"user":{
},
"created_at":"Mon Jun 13 15:48:06 +0000 2016",
"lang":"en",
"favorite_count":0,
"coordinates":null,
"place":null,
"contributors":null,
"in_reply_to_user_id":12552,
"in_reply_to_user_id_str":"12552",
"retweeted":false,
"favorited":false,
"truncated":false,
"entities":{
"user_mentions":[
{
"id_str":"12552",
"id":12552,
"screen_name":"philgyford",
"name":"Phil Gyford",
"indices":[
0,
11
]
}
],
"media":[
],
"hashtags":[
],
"symbols":[
],
"urls":[
]
},
"is_quote_status":false,
"possibly_sensitive":false
}

91
tests/tweets/retweet.json Normal file
View file

@ -0,0 +1,91 @@
{
"coordinates":null,
"source":"web",
"in_reply_to_user_id_str":null,
"truncated":false,
"in_reply_to_user_id":null,
"favorite_count":0,
"user":{
"name":"Phil Gyford Test",
"screen_name":"philgyfordtest"
},
"favorited":false,
"retweeted_status":{
"coordinates":null,
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"in_reply_to_user_id_str":null,
"truncated":false,
"in_reply_to_user_id":null,
"favorite_count":21,
"user":{
"name":"Samuel Pepys",
"screen_name":"samuelpepys"
},
"favorited":false,
"id":917459832885653506,
"contributors":null,
"in_reply_to_screen_name":null,
"geo":null,
"in_reply_to_status_id_str":null,
"id_str":"917459832885653506",
"entities":{
"hashtags":[
],
"symbols":[
],
"user_mentions":[
],
"urls":[
]
},
"in_reply_to_status_id":null,
"text":"My aunt and uncle in a very ill humour one with another, but I made shift with much ado to keep them from scolding.",
"retweet_count":3,
"place":null,
"lang":"en",
"created_at":"Mon Oct 09 18:40:44 +0000 2017",
"is_quote_status":false,
"retweeted":false
},
"id":917712989649801216,
"contributors":null,
"in_reply_to_screen_name":null,
"geo":null,
"in_reply_to_status_id_str":null,
"id_str":"917712989649801216",
"entities":{
"hashtags":[
],
"symbols":[
],
"user_mentions":[
{
"id_str":"14475268",
"indices":[
3,
15
],
"name":"Samuel Pepys",
"id":14475268,
"screen_name":"samuelpepys"
}
],
"urls":[
]
},
"in_reply_to_status_id":null,
"text":"RT @samuelpepys: My aunt and uncle in a very ill humour one with another, but I made shift with much ado to keep them from scolding.",
"retweet_count":3,
"place":null,
"lang":"en",
"created_at":"Tue Oct 10 11:26:41 +0000 2017",
"is_quote_status":false,
"retweeted":false
}

61
tests/tweets/symbols.json Normal file
View file

@ -0,0 +1,61 @@
{
"text":"Some symbols: $AAPL and $PEP and $ANOTHER and $A.",
"contributors":null,
"geo":null,
"favorited":true,
"in_reply_to_user_id_str":null,
"user":{
"screen_name":"philgyfordtest",
"name":"Phil Gyford Test"
},
"in_reply_to_user_id":null,
"retweeted":false,
"coordinates":null,
"place":null,
"in_reply_to_status_id":null,
"lang":"en",
"in_reply_to_status_id_str":null,
"truncated":false,
"retweet_count":0,
"is_quote_status":false,
"id":662694880657989632,
"id_str":"662694880657989632",
"in_reply_to_screen_name":null,
"favorite_count":1,
"entities":{
"hashtags":[
],
"user_mentions":[
],
"symbols":[
{
"indices":[
14,
19
],
"text":"AAPL"
},
{
"indices":[
24,
28
],
"text":"PEP"
},
{
"indices":[
46,
48
],
"text":"A"
}
],
"urls":[
]
},
"created_at":"Fri Nov 06 18:15:46 +0000 2015",
"source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>"
}