示例#1
0
    def test_dependent_phone_numbers(self):
        pn_list = DependentPhoneNumbers(
            'http://api.twilio.com/mock',
            ('user', 'pass'),
        )
        request = Mock()
        request.return_value = (
            Mock(),
            {
                "dependent_phone_numbers": [{
                    "sid": "PN123"
                }],
                "total": 1,
                "page": 0,
                "page_size": 50,
            },
        )
        pn_list.request = request

        result = pn_list.list()
        request.assert_called_with(
            "GET",
            "http://api.twilio.com/mock/DependentPhoneNumbers",
            params={},
        )
        assert_equal(result[0].sid, 'PN123')
示例#2
0
 def dependent_phone_numbers(self, address_sid):
     """
     Return a :class:`DependentPhoneNumbers
     <twilio.rest.resources.DependentPhoneNumbers>` instance for the
     :class:`Address <twilio.rest.resources.Address>` with the given
     address_sid
     """
     base_uri = "%s/Addresses/%s" % (self.account_uri, address_sid)
     return DependentPhoneNumbers(base_uri, self.auth, self.timeout)
    def test_dependent_phone_numbers(self):
        pn_list = DependentPhoneNumbers(
            'http://api.twilio.com/mock',
            ('user', 'pass'),
        )
        request = Mock()
        request.return_value = (
            Mock(),
            {
                "dependent_phone_numbers": [{"sid": "PN123"}],
                "total": 1,
                "page": 0,
                "page_size": 50,
            },
        )
        pn_list.request = request

        result = pn_list.list()
        request.assert_called_with(
            "GET",
            "http://api.twilio.com/mock/DependentPhoneNumbers",
            params={},
        )
        assert_equal(result[0].sid, 'PN123')