Commit 0e0198dd authored by fendouai's avatar fendouai

fix tests in python3

parent ca2cb59a
.. image:: https://travis-ci.org/jpush/jpush-api-python-client.svg?branch=master
:target: https://travis-ci.org/jpush/jpush-api-python-client
.. image:: https://badge.fury.io/gh/jpush%2Fjpush-api-python-client.svg
:target: http://badge.fury.io/gh/jpush%2Fjpush-api-python-client
.. image:: https://badge.fury.io/py/jpush.svg
:target: http://badge.fury.io/py/jpush
.. image:: https://pypip.in/download/jpush/badge.svg
:target: https://pypi.python.org/pypi/jpush/
:alt: Downloads
=======================
JPush API Python Client
=======================
JPush's officially supported Python client library for accessing JPush APIs.
JPush Rest API Documents: `http://docs.jpush.io/server/rest_api_v3_push/ <http://docs.jpush.io/server/rest_api_v3_push/>`_
JPush Rest API Documents: http://docs.jpush.io/server/rest_api_v3_push/
You can download the latest release file here: `Releases <https://github.com/jpush/jpush-api-python-client/releases>`_
You can download the latest release file here: https://github.com/jpush/jpush-api-python-client/releases
------------
Installation
------------
To install jpush-api-python-client, simply:
.. code-block:: sh
$ sudo pip install jpush
or alternatively install via easy_install:
.. code-block:: sh
$ sudo easy_install jpush
or from source:
.. code-block:: sh
$ sudo python setup.py install
-------
......@@ -48,14 +32,12 @@ with Python.
To run jpush-api-python-client tests, simply:
.. code-block:: sh
$ nosetests tests/push tests/devices --verbosity=2
--------
Examples
--------
You can see more examples in `examples <https://github.com/jpush/jpush-api-python-client/blob/master/examples>`_
You can see more examples in https://github.com/jpush/jpush-api-python-client/blob/master/examples
Simple iOS Push
---------------
......@@ -85,8 +67,3 @@ Questions
--------
The best place to ask questions is our community site:
http://community.jpush.cn/
--------
Thanks to
--------
`crystal-wei <https://github.com/crystal-wei>`_ for reporting the jpush-api-python-client issues;
......@@ -30,13 +30,13 @@ class TestAudience(unittest.TestCase):
response = push.send()
self.assertEqual(response.status_code, 200)
except common.Unauthorized, e:
except common.Unauthorized as e:
self.assertFalse(isinstance(e, common.Unauthorized))
raise common.Unauthorized("Unauthorized")
except common.APIConnectionException, e:
except common.APIConnectionException as e:
self.assertFalse(isinstance(e, common.APIConnectionException))
raise common.APIConnectionException("conn")
except common.JPushFailure, e:
except common.JPushFailure as e:
self.assertFalse(isinstance(e, common.JPushFailure))
print ("JPushFailure")
except:
......
......@@ -43,13 +43,13 @@ class TestMessage(unittest.TestCase):
try:
response = push.send()
self.assertEqual(response.status_code, 200)
except common.Unauthorized, e:
except common.Unauthorized as e:
self.assertFalse(isinstance(e, common.Unauthorized))
raise common.Unauthorized("Unauthorized")
except common.APIConnectionException, e:
except common.APIConnectionException as e:
self.assertFalse(isinstance(e, common.APIConnectionException))
raise common.APIConnectionException("conn")
except common.JPushFailure, e:
except common.JPushFailure as e:
self.assertFalse(isinstance(e, common.JPushFailure))
print ("JPushFailure")
except:
......
......@@ -23,6 +23,6 @@ class TestEntity(unittest.TestCase):
try:
result = report.get_users("DAY","2016-04-10","3")
self.assertEqual(result.status_code, 200)
except common.JPushFailure, e:
except common.JPushFailure as e:
self.assertIsInstance(e, common.JPushFailure)
......@@ -37,7 +37,7 @@ class TestEntity(unittest.TestCase):
try:
result = schedule.get_schedule_by_id("3fc6e2fa-15a6-11e6-83d4-0021f653c222")
self.assertNotEqual(result.status_code, 200)
except common.JPushFailure, e:
except common.JPushFailure as e:
self.assertIsInstance(e, common.JPushFailure)
def test_get_schedule_list(self):
......@@ -69,6 +69,6 @@ class TestEntity(unittest.TestCase):
try:
result = schedule.delete_schedule("e9c553d0-0850-11e6-b6d4-0021f652c102")
self.assertNotEqual(result.status_code, 200)
except common.JPushFailure, e:
except common.JPushFailure as e:
self.assertIsInstance(e, common.JPushFailure)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment