-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fax and faxapp additions * update tests to fit required parameters Co-authored-by: Quagser <quagmilion@gmail.com>
- Loading branch information
Showing
6 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from telnyx.api_resources.abstract import ( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
) | ||
|
||
|
||
class FaxApplication( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
): | ||
OBJECT_NAME = "fax_application" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from telnyx.api_resources.abstract import ( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
) | ||
|
||
|
||
class Faxes( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
): | ||
OBJECT_NAME = "Faxes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import telnyx | ||
|
||
TEST_RESOURCE_ID = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" | ||
|
||
|
||
class TestFaxApplication(object): | ||
def test_is_listable(self, request_mock): | ||
resources = telnyx.FaxApplication.list() | ||
request_mock.assert_requested("get", "/v2/fax_applications") | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], telnyx.FaxApplication) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
resource = telnyx.FaxApplication.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested( | ||
"get", "/v2/fax_applications/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.FaxApplication) | ||
|
||
def test_is_creatable(self, request_mock): | ||
resource = telnyx.FaxApplication.create( | ||
active=True, | ||
application_name="Test Name", | ||
webhook_event_url="https://test.com", | ||
) | ||
request_mock.assert_requested("post", "/v2/fax_applications") | ||
assert isinstance(resource, telnyx.FaxApplication) | ||
|
||
def test_is_saveable(self, request_mock): | ||
fax_application = telnyx.FaxApplication.retrieve(TEST_RESOURCE_ID) | ||
fax_application.active = False | ||
fax_application.webhook_event_url = "https://update.com" | ||
fax_application.application_name = "updated name" | ||
resource = fax_application.save() | ||
request_mock.assert_requested( | ||
"patch", "/v2/fax_applications/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.FaxApplication) | ||
assert resource is fax_application | ||
|
||
def test_is_modifiable(self, request_mock): | ||
resource = telnyx.FaxApplication.modify( | ||
TEST_RESOURCE_ID, | ||
active=False, | ||
webhook_event_url="https://update.com", | ||
application_name="updated name", | ||
) | ||
request_mock.assert_requested( | ||
"patch", "/v2/fax_applications/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.FaxApplication) | ||
|
||
def test_is_deletable(self, request_mock): | ||
resource = telnyx.FaxApplication.retrieve(TEST_RESOURCE_ID) | ||
resource.delete() | ||
request_mock.assert_requested( | ||
"delete", "/v2/fax_applications/%s" % TEST_RESOURCE_ID | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters