diff --git a/python-python-twitter-fix-test.patch b/python-python-twitter-fix-test.patch new file mode 100644 index 0000000..e5add84 --- /dev/null +++ b/python-python-twitter-fix-test.patch @@ -0,0 +1,26 @@ +diff --git a/testdata/direct_messages/post_post_direct_message.json b/testdata/direct_messages/post_post_direct_message.json +index c4c2d59f..9e861211 100644 +--- a/testdata/direct_messages/post_post_direct_message.json ++++ b/testdata/direct_messages/post_post_direct_message.json +@@ -1 +1 @@ +-{"sender_id_str": "372018022", "entities": {"urls": [{"expanded_url": "https://twitter.com/CamilleStein/status/854322543364382720", "indices": [0, 23], "url": "https://t.co/L4MIplKUwR", "display_url": "twitter.com/CamilleStein/s\u2026"}], "symbols": [], "hashtags": [], "user_mentions": []}, "recipient_id": 3206731269, "text": "https://t.co/L4MIplKUwR", "id_str": "855194351294656515", "sender_id": 372018022, "id": 855194351294656515, "created_at": "Thu Apr 20 22:59:56 +0000 2017", "recipient_id_str": "3206731269", "recipient": {"is_translation_enabled": false, "following": true, "name": "The GIFing Bot", "profile_image_url": "http://pbs.twimg.com/profile_images/592359786659880960/IwQsKZ7b_normal.png", "profile_sidebar_border_color": "000000", "followers_count": 84, "created_at": "Sat Apr 25 16:31:07 +0000 2015", "profile_link_color": "02B400", "is_translator": false, "id": 3206731269, "profile_sidebar_fill_color": "000000", "has_extended_profile": false, "profile_background_tile": false, "profile_use_background_image": false, "default_profile_image": false, "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", "lang": "en", "verified": false, "favourites_count": 0, "protected": false, "notifications": false, "friends_count": 100, "listed_count": 7, "location": "", "statuses_count": 19, "entities": {"url": {"urls": [{"expanded_url": "http://iseverythingstilltheworst.com/projects/the-gifing-bot/", "indices": [0, 23], "url": "https://t.co/BTsv2OJnqv", "display_url": "iseverythingstilltheworst.com/projects/the-g\u2026"}]}, "description": {"urls": []}}, "url": "https://t.co/BTsv2OJnqv", "utc_offset": null, "time_zone": null, "profile_background_color": "000000", "id_str": "3206731269", "description": "DM me a tweet with a GIF in it and I'll make it into an actual GIF!!", "follow_request_sent": false, "screen_name": "TheGIFingBot", "profile_text_color": "000000", "translator_type": "none", "profile_image_url_https": "https://pbs.twimg.com/profile_images/592359786659880960/IwQsKZ7b_normal.png", "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", "contributors_enabled": false, "default_profile": false, "geo_enabled": false}, "sender": {"is_translation_enabled": false, "following": false, "name": "Jeremy", "profile_image_url": "http://pbs.twimg.com/profile_images/800076020741246976/fMpwMcBJ_normal.jpg", "profile_sidebar_border_color": "000000", "followers_count": 142, "created_at": "Sun Sep 11 23:49:28 +0000 2011", "profile_link_color": "EE3355", "is_translator": false, "id": 372018022, "profile_sidebar_fill_color": "000000", "has_extended_profile": false, "profile_background_tile": false, "profile_use_background_image": false, "default_profile_image": false, "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", "lang": "en", "verified": false, "favourites_count": 7546, "protected": false, "notifications": false, "friends_count": 593, "listed_count": 11, "location": "philly", "statuses_count": 1785, "entities": {"url": {"urls": [{"expanded_url": "http://iseverythingstilltheworst.com", "indices": [0, 23], "url": "https://t.co/wtg3XyREnj", "display_url": "iseverythingstilltheworst.com"}]}, "description": {"urls": []}}, "url": "https://t.co/wtg3XyREnj", "utc_offset": -14400, "time_zone": "Eastern Time (US & Canada)", "profile_background_color": "FFFFFF", "id_str": "372018022", "description": "these people have addresses | #botally", "follow_request_sent": false, "screen_name": "__jcbl__", "profile_text_color": "000000", "translator_type": "none", "profile_image_url_https": "https://pbs.twimg.com/profile_images/800076020741246976/fMpwMcBJ_normal.jpg", "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", "profile_banner_url": "https://pbs.twimg.com/profile_banners/372018022/1475799101", "contributors_enabled": false, "default_profile": false, "geo_enabled": false}, "sender_screen_name": "__jcbl__", "recipient_screen_name": "TheGIFingBot"} +\ No newline at end of file ++{"event": {"type": "message_create", "id": "1046388258840748037", "created_timestamp": "1538313376518", "message_create": {"target": {"recipient_id": "372018022"}, "sender_id": "372018022", "message_data": {"text": "hello", "entities": {"hashtags": [], "symbols": [], "user_mentions": [], "urls": []}}}}} +\ No newline at end of file +diff --git a/tests/test_direct_messages.py b/tests/test_direct_messages.py +index 348ea525..fa9108c6 100644 +--- a/tests/test_direct_messages.py ++++ b/tests/test_direct_messages.py +@@ -63,9 +63,9 @@ def test_post_direct_message(): + with open('testdata/direct_messages/post_post_direct_message.json', 'r') as f: + responses.add(POST, DEFAULT_URL, body=f.read()) + resp = api.PostDirectMessage(user_id='372018022', +- text='https://t.co/L4MIplKUwR') ++ text='hello') + assert isinstance(resp, twitter.DirectMessage) +- assert resp.text == 'https://t.co/L4MIplKUwR' ++ assert resp.text == 'hello' + + + @responses.activate + diff --git a/python-python-twitter.changes b/python-python-twitter.changes index fa40040..c370604 100644 --- a/python-python-twitter.changes +++ b/python-python-twitter.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Thu May 9 09:12:21 UTC 2019 - pgajdos@suse.com + +- version update to 3.5 + * Fix DM endpoint handling +- added patches + fix test for PostDirectMessage endpoint with new data + + python-python-twitter-fix-test.patch +- run tests + ------------------------------------------------------------------- Tue Dec 4 12:53:09 UTC 2018 - Matej Cepl diff --git a/python-python-twitter.spec b/python-python-twitter.spec index 07e6c6d..29c417a 100644 --- a/python-python-twitter.spec +++ b/python-python-twitter.spec @@ -1,7 +1,7 @@ # # spec file for package python-python-twitter # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,23 +17,32 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%ifarch %{ix86} +# (type(resp[0]) is int) is not true for python 2.7, as it is long +%define skip -k 'not (testGetFollowerIDsPaged or testGetFollowersIDs or testGetRetweeters)' +%endif %define oldpython python Name: python-python-twitter -Version: 3.4.2 +Version: 3.5 Release: 0 Summary: A Python wrapper around the Twitter API License: Apache-2.0 Group: Development/Languages/Python Url: https://github.com/bear/python-twitter -Source: https://files.pythonhosted.org/packages/source/p/python-twitter/python-twitter-%{version}.tar.gz +Source: https://github.com/bear/python-twitter/archive/v%{version}.tar.gz +# https://github.com/bear/python-twitter/commit/f7eb83d9dca3ba0ee93e629ba5322732f99a3a30 +# fix test for PostDirectMessage endpoint with new data +Patch0: python-python-twitter-fix-test.patch BuildRequires: %{python_module pytest-runner} BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros # SECTION test requirements BuildRequires: %{python_module future} +BuildRequires: %{python_module hypothesis} BuildRequires: %{python_module pytest} BuildRequires: %{python_module requests-oauthlib} BuildRequires: %{python_module requests} +BuildRequires: %{python_module responses} # /SECTION BuildRequires: fdupes Requires: python-future @@ -55,7 +64,9 @@ which can be used using this library. %prep %setup -q -n python-twitter-%{version} -sed -i '1s/#!//' twitter/*.py +%patch0 -p1 +sed -i -e '/^#!\/usr\/bin\/env/d' twitter/*.py +echo %skip %build %python_build @@ -64,8 +75,11 @@ sed -i '1s/#!//' twitter/*.py %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +%pytest %{?skip} + %files %{python_files} -%doc AUTHORS.rst CHANGES README.rst GAE.rst +%doc AUTHORS.rst CHANGES README.rst GAE.rst NOTICE %license LICENSE %{python_sitelib}/* diff --git a/python-twitter-3.4.2.tar.gz b/python-twitter-3.4.2.tar.gz deleted file mode 100644 index b991253..0000000 --- a/python-twitter-3.4.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:77ebcf2344b622d2fa1e54a851971e030ae313c754863b435e5c1827be97a721 -size 82632 diff --git a/v3.5.tar.gz b/v3.5.tar.gz new file mode 100644 index 0000000..46d8d99 --- /dev/null +++ b/v3.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47996228cb738d6c1bcdeabdc5a3b738e357e395b488023f033ad86da0aa3563 +size 5144728