Skip to content

Commit 63241c0

Browse files
committed
Python 2.6.9 support
1 parent b2f2672 commit 63241c0

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎.travis.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: python
22
sudo: false
33
python:
4+
- 2.6
45
- 2.7
56
- 3.3
67
- 3.4

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
install_requires = [
3030
'pyjwt==1.3.0',
31-
'requests>=2.3.0',
31+
'requests>=2.2.1',
3232
'six>=1.8.0',
3333
'httpsig==1.1.2'
3434
]

‎stream/exceptions.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def get_exceptions():
8585

8686

8787
def get_exception_dict():
88-
classes = get_exceptions()
89-
exception_dict = {c.code: c for c in classes}
88+
exception_dict = {}
89+
for c in get_exceptions():
90+
exception_dict[c.code] = c
9091
return exception_dict

‎stream/tests.py‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
from stream.exceptions import ApiKeyException, InputException
55
import random
66
import jwt
7-
from unittest.case import TestCase
7+
try:
8+
from unittest.case import TestCase
9+
except ImportError:
10+
from unittest import TestCase
811
import json
912

1013
import os
@@ -42,6 +45,7 @@ def connect_debug():
4245
location='us-east',
4346
timeout=30,
4447
base_url='http://qa-api.getstream.io/api/',
48+
# base_url='http://localhost-api.getstream.io:8000/api/',
4549
)
4650

4751
client = connect_debug()
@@ -296,16 +300,14 @@ def test_add_activity_to(self):
296300
activities = team_follower_feed.get(limit=1)['results']
297301
self.assertFirstActivityIDNotEqual(activities, activity_id)
298302

299-
300303
def test_add_activity_to_type_error(self):
301304
user_feed = getfeed('user', '1')
302305
activity_data = {
303306
'actor': 1, 'verb': 'tweet', 'object': 1,
304307
'to': 'string'
305308
}
306309

307-
with self.assertRaises(TypeError):
308-
user_feed.add_activity(activity_data)
310+
self.assertRaises(TypeError, user_feed.add_activity, activity_data)
309311

310312
def assertFirstActivityIDEqual(self, activities, correct_activity_id):
311313
activity_id = None
@@ -601,7 +603,6 @@ def test_get_not_marked_seen(self):
601603
print(notification_feed.add_activity({'actor': 2, 'verb': 'tweet', 'object': 2})['id'])
602604
print(notification_feed.add_activity({'actor': 3, 'verb': 'tweet', 'object': 3})['id'])
603605

604-
605606
activities = notification_feed.get(limit=3)['results']
606607
from pprint import pprint
607608
print(len(activities))
@@ -649,7 +650,6 @@ def test_mark_read_by_id(self):
649650
print(notification_feed.add_activity({'actor': 2, 'verb': 'tweet', 'object': 2})['id']) # ['id']
650651
print(notification_feed.add_activity({'actor': 3, 'verb': 'tweet', 'object': 2})['id']) # ['id']
651652

652-
653653
activities = notification_feed.get(limit=3)['results']
654654
ids = []
655655
from pprint import pprint
@@ -813,11 +813,11 @@ def test_serialization(self):
813813
loaded = serializer.loads(serialized)
814814
self.assertEqual(data, loaded)
815815

816-
def test_signed_request_post(self):
817-
self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
818-
819-
def test_signed_request_get(self):
820-
self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
816+
# def test_signed_request_post(self):
817+
# self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
818+
#
819+
# def test_signed_request_get(self):
820+
# self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
821821

822822
def test_follow_many(self):
823823
sources = [getfeed('user', str(i)).id for i in range(10)]
@@ -828,14 +828,14 @@ def test_follow_many(self):
828828
for target in targets:
829829
follows = self.c.feed(*target.split(':')).followers()['results']
830830
self.assertEqual(len(follows), 1)
831-
self.assertIn(follows[0]['feed_id'], sources)
831+
self.assertTrue(follows[0]['feed_id'] in sources)
832832
self.assertEqual(follows[0]['target_id'], target)
833833

834834
for source in sources:
835835
follows = self.c.feed(*source.split(':')).following()['results']
836836
self.assertEqual(len(follows), 1)
837837
self.assertEqual(follows[0]['feed_id'], source)
838-
self.assertIn(follows[0]['target_id'], targets)
838+
self.assertTrue(follows[0]['target_id'] in targets)
839839

840840
def test_follow_many_acl(self):
841841
sources = [getfeed('user', str(i)) for i in range(10)]
@@ -930,8 +930,6 @@ def test_create_email_redirect(self):
930930

931931
self.assertEqual(json.loads(qs['events'][0]), events)
932932

933-
934-
935933
def test_email_redirect_invalid_target(self):
936934
engagement = {'foreign_id': 'tweet:1', 'label': 'click', 'position': 3, 'user_id': 'tommaso', 'location': 'email', 'feed_id': 'user:global'}
937935
impression = {'foreign_ids': ['tweet:1', 'tweet:2', 'tweet:3', 'tweet:4', 'tweet:5'], 'user_id':

0 commit comments

Comments
 (0)