updated unit tests and travis config for python 2.6 and 3

This commit is contained in:
cash 2014-01-11 15:52:46 -05:00
parent c449e3f8e1
commit 30ff4319e2
6 changed files with 19 additions and 20 deletions

View file

@ -1,21 +1,17 @@
from twython import Twython, TwythonError, TwythonAuthError
from .config import (
test_tweet_object, test_tweet_html
test_tweet_object, test_tweet_html, unittest
)
try:
import unittest2 as unittest
except ImportError:
import unittest
import responses
import requests
try:
import io.StringIO as StringIO
except ImportError:
import StringIO
from twython.compat import is_py2
if is_py2:
from StringIO import StringIO
else:
from io import StringIO
try:
import unittest.mock as mock
@ -141,7 +137,7 @@ class TwythonAPITestCase(unittest.TestCase):
url = self.get_url(endpoint)
responses.add(responses.POST, url)
mock_file = StringIO.StringIO("Twython test image")
mock_file = StringIO("Twython test image")
self.api.request(endpoint, method='POST', params={'image': mock_file})
self.assertIn('filename="image"', responses.calls[0].request.body)