-
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.
- Loading branch information
Showing
16 changed files
with
348 additions
and
10 deletions.
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
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,7 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from telnyx.api_resources.abstract import ListableAPIResource | ||
|
||
|
||
class Connection(ListableAPIResource): | ||
OBJECT_NAME = "connection" |
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 CredentialConnection( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
): | ||
OBJECT_NAME = "credential_connection" |
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 FQDN( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
): | ||
OBJECT_NAME = "fqdn" |
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 FQDNConnection( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
): | ||
OBJECT_NAME = "fqdn_connection" |
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 IP( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
): | ||
OBJECT_NAME = "ip" |
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 IPConnection( | ||
CreateableAPIResource, | ||
DeletableAPIResource, | ||
ListableAPIResource, | ||
UpdateableAPIResource, | ||
): | ||
OBJECT_NAME = "ip_connection" |
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,26 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import telnyx | ||
|
||
TEST_RESOURCE_ID = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" | ||
|
||
|
||
class TestConnection(object): | ||
connection_types = ( | ||
telnyx.IPConnection, | ||
telnyx.CredentialConnection, | ||
telnyx.IP, | ||
telnyx.FQDNConnection, | ||
telnyx.FQDN, | ||
) | ||
|
||
def test_is_listable(self, request_mock): | ||
resources = telnyx.Connection.list() | ||
request_mock.assert_requested("get", "/v2/connections") | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], self.connection_types) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
resource = telnyx.Connection.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested("get", "/v2/connections/%s" % TEST_RESOURCE_ID) | ||
assert isinstance(resource, self.connection_types) |
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,49 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import telnyx | ||
|
||
TEST_RESOURCE_ID = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" | ||
|
||
|
||
class TestCredentialConnection(object): | ||
def test_is_listable(self, request_mock): | ||
resources = telnyx.CredentialConnection.list() | ||
request_mock.assert_requested("get", "/v2/credential_connections") | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], telnyx.CredentialConnection) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
resource = telnyx.CredentialConnection.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested( | ||
"get", "/v2/credential_connections/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.CredentialConnection) | ||
|
||
def test_is_creatable(self, request_mock): | ||
resource = telnyx.CredentialConnection.create(active=True) | ||
request_mock.assert_requested("post", "/v2/credential_connections") | ||
assert isinstance(resource, telnyx.CredentialConnection) | ||
|
||
def test_is_saveable(self, request_mock): | ||
credential_connection = telnyx.CredentialConnection.retrieve(TEST_RESOURCE_ID) | ||
credential_connection.active = False | ||
resource = credential_connection.save() | ||
request_mock.assert_requested( | ||
"patch", "/v2/credential_connections/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.CredentialConnection) | ||
assert resource is credential_connection | ||
|
||
def test_is_modifiable(self, request_mock): | ||
resource = telnyx.CredentialConnection.modify(TEST_RESOURCE_ID, active=False) | ||
request_mock.assert_requested( | ||
"patch", "/v2/credential_connections/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.CredentialConnection) | ||
|
||
def test_is_deletable(self, request_mock): | ||
resource = telnyx.CredentialConnection.retrieve(TEST_RESOURCE_ID) | ||
resource.delete() | ||
request_mock.assert_requested( | ||
"delete", "/v2/credential_connections/%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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import telnyx | ||
|
||
TEST_RESOURCE_ID = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" | ||
|
||
|
||
class TestFQDN(object): | ||
def test_is_listable(self, request_mock): | ||
resources = telnyx.FQDN.list() | ||
request_mock.assert_requested("get", "/v2/fqdns") | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], telnyx.FQDN) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
resource = telnyx.FQDN.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested("get", "/v2/fqdns/%s" % TEST_RESOURCE_ID) | ||
assert isinstance(resource, telnyx.FQDN) | ||
|
||
def test_is_creatable(self, request_mock): | ||
resource = telnyx.FQDN.create(fqdn="example.com") | ||
request_mock.assert_requested("post", "/v2/fqdns") | ||
assert isinstance(resource, telnyx.FQDN) | ||
|
||
def test_is_saveable(self, request_mock): | ||
fqdn = telnyx.FQDN.retrieve(TEST_RESOURCE_ID) | ||
fqdn.fqdn = "new-example.com" | ||
resource = fqdn.save() | ||
request_mock.assert_requested("patch", "/v2/fqdns/%s" % TEST_RESOURCE_ID) | ||
assert isinstance(resource, telnyx.FQDN) | ||
assert resource is fqdn | ||
|
||
def test_is_modifiable(self, request_mock): | ||
resource = telnyx.FQDN.modify(TEST_RESOURCE_ID, fqdn="new-example.com") | ||
request_mock.assert_requested("patch", "/v2/fqdns/%s" % TEST_RESOURCE_ID) | ||
assert isinstance(resource, telnyx.FQDN) | ||
|
||
def test_is_deletable(self, request_mock): | ||
resource = telnyx.FQDN.retrieve(TEST_RESOURCE_ID) | ||
resource.delete() | ||
request_mock.assert_requested("delete", "/v2/fqdns/%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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import telnyx | ||
|
||
TEST_RESOURCE_ID = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" | ||
|
||
|
||
class TestFQDNConnection(object): | ||
def test_is_listable(self, request_mock): | ||
resources = telnyx.FQDNConnection.list() | ||
request_mock.assert_requested("get", "/v2/fqdn_connections") | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], telnyx.FQDNConnection) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
resource = telnyx.FQDNConnection.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested( | ||
"get", "/v2/fqdn_connections/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.FQDNConnection) | ||
|
||
def test_is_creatable(self, request_mock): | ||
resource = telnyx.FQDNConnection.create(active=True) | ||
request_mock.assert_requested("post", "/v2/fqdn_connections") | ||
assert isinstance(resource, telnyx.FQDNConnection) | ||
|
||
def test_is_saveable(self, request_mock): | ||
fqdn_connection = telnyx.FQDNConnection.retrieve(TEST_RESOURCE_ID) | ||
fqdn_connection.active = False | ||
resource = fqdn_connection.save() | ||
request_mock.assert_requested( | ||
"patch", "/v2/fqdn_connections/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.FQDNConnection) | ||
assert resource is fqdn_connection | ||
|
||
def test_is_modifiable(self, request_mock): | ||
resource = telnyx.FQDNConnection.modify(TEST_RESOURCE_ID, active=False) | ||
request_mock.assert_requested( | ||
"patch", "/v2/fqdn_connections/%s" % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, telnyx.FQDNConnection) | ||
|
||
def test_is_deletable(self, request_mock): | ||
resource = telnyx.FQDNConnection.retrieve(TEST_RESOURCE_ID) | ||
resource.delete() | ||
request_mock.assert_requested( | ||
"delete", "/v2/fqdn_connections/%s" % TEST_RESOURCE_ID | ||
) |
Oops, something went wrong.