Skip to content

Commit

Permalink
Merge pull request #134 from plivo/ppai-ppk-tests
Browse files Browse the repository at this point in the history
powerpack: Fix unit tests
  • Loading branch information
nixonsam authored Jun 12, 2020
2 parents df33a46 + d8fac97 commit 57a36cb
Show file tree
Hide file tree
Showing 22 changed files with 332 additions and 29 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [4.8.1](https://github.com/plivo/plivo-python/tree/v4.8.1) (2020-06-12)
- Fix SMS Test cases.

## [4.8.0](https://github.com/plivo/plivo-python/tree/v4.8.0) (2020-05-28)
- Add JWT helper functions.

Expand Down
4 changes: 2 additions & 2 deletions plivo/resources/numberpools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, client, number_pool_id):


class Numbers(PlivoResource):
_name = 'Shortcodes'
_name = 'Numbers'
_identifier_string = 'number_pool_id'

def buy_add_number(self,
Expand Down Expand Up @@ -240,4 +240,4 @@ def remove(self, tollfree, unrent=False):
'DELETE', ('NumberPool',self.number_pool_id,'Tollfree', tollfree), params,
response_type=None,
objects_type=None)

2 changes: 1 addition & 1 deletion plivo/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '4.8.0'
__version__ = '4.8.1'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='plivo',
version='4.8.0',
version='4.8.1',
description='A Python SDK to make voice calls & send SMS using Plivo and to generate Plivo XML',
long_description=long_description,
url='https://github.com/plivo/plivo-python',
Expand Down
11 changes: 11 additions & 0 deletions tests/resources/fixtures/powerpackAddNumberResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"account_phone_number_resource": "/v1/Account/<auth_id>/Number/<your_number>/",
"added_on": "2019-10-09T11:24:35.085797Z",
"api_id": "612982e8-0a87-11ea-b072-0242ac110007",
"country_iso2": "CA",
"number": "15799140336",
"uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool_uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool": "/v1/Account/MAODZKMDFJMJU3MTEYNG/NumberPool/ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f/",
"type": "fixed"
}
11 changes: 11 additions & 0 deletions tests/resources/fixtures/powerpackAddTollfreeResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"account_phone_number_resource": "/v1/Account/<auth_id>/Number/<your_number>/",
"added_on": "2019-10-09T11:24:35.085797Z",
"api_id": "612982e8-0a87-11ea-b072-0242ac110007",
"country_iso2": "CA",
"number": "15799140336",
"uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool_uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool": "/v1/Account/MAODZKMDFJMJU3MTEYNG/NumberPool/ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f/",
"type": "fixed"
}
11 changes: 11 additions & 0 deletions tests/resources/fixtures/powerpackBuyAndNumberResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"account_phone_number_resource": "/v1/Account/<auth_id>/Number/<your_number>/",
"added_on": "2019-10-09T11:24:35.085797Z",
"api_id": "612982e8-0a87-11ea-b072-0242ac110007",
"country_iso2": "CA",
"number": "14845071864",
"uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool_uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool": "/v1/Account/MAODZKMDFJMJU3MTEYNG/NumberPool/ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f/",
"type": "fixed"
}
43 changes: 43 additions & 0 deletions tests/resources/fixtures/powerpackCountNumbersResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"account_phone_number_resource": "/v1/Account/<auth_id>/Number/<your_number>/",
"added_on": "2019-10-09T11:24:35.085797Z",
"api_id": "612982e8-0a87-11ea-b072-0242ac110007",
"country_iso2": "CA",
"uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool_uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool": "/v1/Account/MAODZKMDFJMJU3MTEYNG/NumberPool/ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f/",
"api_id": "0dacbefa-0a87-11ea-b072-0242ac110007",
"meta": {
"limit": 20,
"next": "",
"offset": 0,
"previous": "",
"total_count": 6
},
"objects": [
{
"account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
"added_on": "2019-10-09T11:24:35.085797Z",
"country_iso2": "US",
"number": "{your_number}",
"number_pool_uuid": "{number_pool_uuid}",
"type": "fixed"
},
{
"account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
"added_on": "2019-10-09T11:24:35.085797Z",
"country_iso2": "US",
"number": "{your_number}",
"number_pool_uuid": "{number_pool_uuid}",
"type": "fixed"
},
{
"account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
"added_on": "2019-10-09T11:24:35.085797Z",
"country_iso2": "CA",
"number": "{your_number}",
"number_pool_uuid": "{number_pool_uuid}",
"type": "fixed"
}
]
}
11 changes: 11 additions & 0 deletions tests/resources/fixtures/powerpackCreatePowerpackResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"api_id": "4b2c83c4-09ff-11ea-b072-0242ac110007",
"application_id": "20342783288007824",
"application_type": "XML",
"created_on": "2019-10-09T11:10:59.666461Z",
"local_connect": true,
"name": "test",
"number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
"sticky_sender": true,
"uuid": "<powerpack_uuid>"
}
10 changes: 10 additions & 0 deletions tests/resources/fixtures/powerpackDeletePowerpackResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"uuid": "dfsd-fsdfsd-345dfsd-fsdfs-sdfsd",
"name": "My Powerpack",
"smart_sender": true,
"local_connect": false,
"application_type": "XML",
"application_id": 123912833468,
"number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
"created_on": "2019-07-15T12:22:00Z"
}
20 changes: 20 additions & 0 deletions tests/resources/fixtures/powerpackFindShortcodeResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"api_id": "614b2776-0a88-11ea-b072-0242ac110007",
"number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
"uuid": "dfsd-fsdfsd-345dfsd-fsdfs-sdfsd",
"meta": {
"limit": 20,
"next": "",
"offset": 0,
"previous": "",
"total_count": 1
},
"objects": [
{
"added_on": "2019-10-09T11:10:59.741978Z",
"country_iso2": "US",
"number_pool_uuid": "{number_pool_uuid}",
"shortcode": "444444"
}
]
}
20 changes: 20 additions & 0 deletions tests/resources/fixtures/powerpackFindTollfreeResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"api_id": "614b2776-0a88-11ea-b072-0242ac110007",
"number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
"uuid": "dfsd-fsdfsd-345dfsd-fsdfs-sdfsd",
"meta": {
"limit": 20,
"next": "",
"offset": 0,
"previous": "",
"total_count": 1
},
"objects": [
{
"added_on": "2019-10-09T11:10:59.741978Z",
"country_iso2": "US",
"number_pool_uuid": "{number_pool_uuid}",
"tollfree": "18772209942"
}
]
}
10 changes: 10 additions & 0 deletions tests/resources/fixtures/powerpackGetPowerpackResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"uuid": "5ec4c8c9-cd74-42b5-9e41-0d7670d6bb46",
"name": "My Powerpack",
"smart_sender": true,
"local_connect": false,
"application_type": "XML",
"application_id": 123912833468,
"number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
"created_on": "2019-07-15T12:22:00Z"
}
38 changes: 38 additions & 0 deletions tests/resources/fixtures/powerpackListNumbersResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"api_id": "0dacbefa-0a87-11ea-b072-0242ac110007",
"uuid": "d35f2e82-d387-427f-8594-6fa07613c43a",
"number_pool": "/v1/Account/{auth_id}/NumberPool/d35f2e82-d387-427f-8594-6fa07613c43a/",
"meta": {
"limit": 20,
"next": "",
"offset": 0,
"previous": "",
"total_count": 3
},
"objects": [
{
"account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
"added_on": "2019-10-09T11:24:35.085797Z",
"country_iso2": "US",
"number": "{your_number}",
"number_pool_uuid": "d35f2e82-d387-427f-8594-6fa07613c43a",
"type": "fixed"
},
{
"account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
"added_on": "2019-10-09T11:24:35.085797Z",
"country_iso2": "US",
"number": "{your_number}",
"number_pool_uuid": "d35f2e82-d387-427f-8594-6fa07613c43a",
"type": "fixed"
},
{
"account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
"added_on": "2019-10-09T11:24:35.085797Z",
"country_iso2": "CA",
"number": "{your_number}",
"number_pool_uuid": "d35f2e82-d387-427f-8594-6fa07613c43a",
"type": "fixed"
}
]
}
41 changes: 41 additions & 0 deletions tests/resources/fixtures/powerpackListPowerpackResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"api_id": "e44c159e-0a02-11ea-b072-0242ac110007",
"meta": {
"limit": 20,
"next": "/api/v1/account/xxxxxxx/Powerpack?offset=20&limit=20",
"offset": 0,
"total_count": 53
},
"objects": [
{
"application_id": "",
"application_type": "",
"created_on": "2019-10-09T11:10:59.666461Z",
"local_connect": true,
"name": "test",
"number_pool": "/v1/Account/xxxxxxxxx/NumberPool/<number_pool_uuid>/",
"sticky_sender": true,
"uuid": "<powerpack_uuid>"
},
{
"application_id": "",
"application_type": "",
"created_on": "2019-10-09T17:03:31.837944Z",
"local_connect": false,
"name": "p23",
"number_pool": "/v1/Account/xxxxxxxx/NumberPool/<number_pool_uuid>/",
"sticky_sender": false,
"uuid": "<powerpack_uuid>"
},
{
"application_id": "",
"application_type": "",
"created_on": "2019-10-09T16:54:34.0117Z",
"local_connect": false,
"name": "p22",
"number_pool": "/v1/Account/xxxxxxxx/NumberPool/<number_pool_uuid>/",
"sticky_sender": false,
"uuid": "<powerpack_uuid>"
}
]
}
20 changes: 20 additions & 0 deletions tests/resources/fixtures/powerpackListShortcodeResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"api_id": "614b2776-0a88-11ea-b072-0242ac110007",
"uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool": "/v1/Account/xxxxxxxxx/NumberPool/ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f/",
"meta": {
"limit": 20,
"offset": 0,
"next": "",
"previous": "",
"total_count": 1
},
"objects": [
{
"added_on": "2019-10-09T11:10:59.741978Z",
"country_iso2": "US",
"number_pool_uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"shortcode": "{your_shortcode}"
}
]
}
20 changes: 20 additions & 0 deletions tests/resources/fixtures/powerpackListTollfreeResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"api_id": "614b2776-0a88-11ea-b072-0242ac110007",
"uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"number_pool": "/v1/Account/xxxxxxxxx/NumberPool/ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f/",
"meta": {
"limit": 20,
"offset": 0,
"next": "",
"previous": "",
"total_count": 1
},
"objects": [
{
"added_on": "2019-10-09T11:10:59.741978Z",
"country_iso2": "US",
"number_pool_uuid": "ca5fd1f2-26c0-43e9-a7e4-0dc426e9dd2f",
"tollfree": "{your_tollfree}"
}
]
}
10 changes: 10 additions & 0 deletions tests/resources/fixtures/powerpackRemoveNumberResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"uuid": "d35f2e82-d387-427f-8594-6fa07613c43a",
"name": "My Powerpack",
"smart_sender": true,
"local_connect": false,
"application_type": "XML",
"application_id": 123912833468,
"number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
"created_on": "2019-07-15T12:22:00Z"
}
10 changes: 10 additions & 0 deletions tests/resources/fixtures/powerpackRemoveShortcodeResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"uuid": "d35f2e82-d387-427f-8594-6fa07613c43a",
"name": "My Powerpack",
"smart_sender": true,
"local_connect": false,
"application_type": "XML",
"application_id": 123912833468,
"number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
"created_on": "2019-07-15T12:22:00Z"
}
10 changes: 10 additions & 0 deletions tests/resources/fixtures/powerpackRemoveTollfreeResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"uuid": "d35f2e82-d387-427f-8594-6fa07613c43a",
"name": "My Powerpack",
"smart_sender": true,
"local_connect": false,
"application_type": "XML",
"application_id": 123912833468,
"number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
"created_on": "2019-07-15T12:22:00Z"
}
12 changes: 12 additions & 0 deletions tests/resources/fixtures/powerpackUpdatePowerpackResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"api_id": "4b2c83c4-09ff-11ea-b072-0242ac110007",
"uuid": "d35f2e82-d387-427f-8594-6fa07613c43a",
"application_id": "20342783288007824",
"application_type": "XML",
"created_on": "2019-10-09T11:10:59.666461Z",
"local_connect": true,
"name": "test",
"number_pool": "/v1/Account/{auth_id}/NumberPool/d35f2e82-d387-427f-8594-6fa07613c43a/",
"sticky_sender": true,
"uuid": "<powerpack_uuid>"
}
Loading

0 comments on commit 57a36cb

Please sign in to comment.