urbanairship / python-library

A Python library for using the Airship APIs for push notifications, reporting and other message types
https://docs.airship.com/api/libraries/python/
Other
82 stars 67 forks source link

Allow mocking the PUSH_URL by making logging more robust #31

Closed florianpilz closed 7 years ago

florianpilz commented 8 years ago

Currently there is no support for writing unit tests using the library. Since I do not need to send real pushes during unit tests, mocking urbanairship.common.PUSH_URL to send notifications to https://go.urbanairship.com/api/push/validate/ would be sufficient to make sure the payload is alright.

However, the response for validate is just {"ok":true}, i.e. data does not contain push_ids. Therefore urbanairship.push.core.Push.send will raise inside the logging statement. This PR makes the logging more robust, so mocking urbanairship.common.PUSH_URL with https://go.urbanairship.com/api/push/validate/ succeeds and can be used for testing.

pdxmele commented 7 years ago

Hi, can you please sign our contribution agreement if you're still interested in having us integrate this into our library? http://docs.urbanairship.com/contribution-agreement/

whyqqqqq commented 7 years ago

This enhancement has been released in version 2.0.0 - thank you!

florianpilz commented 7 years ago

👍