1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
|
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class UsAppToPersonUsecaseTestCase(IntegrationTestCase):
def test_fetch_request(self):
self.holodeck.mock(Response(500, ''))
with self.assertRaises(TwilioException):
self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
.us_app_to_person_usecases.fetch()
self.holodeck.assert_has_request(Request(
'get',
'https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Compliance/Usa2p/Usecases',
))
def test_fetch_with_brand_registration_sid_response(self):
self.holodeck.mock(Response(
200,
'''
{
"us_app_to_person_usecases": [
{
"code": "2FA",
"name": "Two-Factor authentication (2FA)",
"description": "Two-Factor authentication, one-time use password, password reset",
"post_approval_required": false
},
{
"code": "ACCOUNT_NOTIFICATION",
"name": "Account Notification",
"description": "All reminders, alerts, and notifications. (Examples include: flight delayed, hotel booked, appointment reminders.)",
"post_approval_required": false
},
{
"code": "AGENTS_FRANCHISES",
"name": "Agents and Franchises",
"description": "For brands that have multiple agents, franchises or offices in the same brand vertical, but require individual localised numbers per agent/location/office.",
"post_approval_required": true
},
{
"code": "CHARITY",
"name": "Charity",
"description": "Includes: 5013C Charity\\nDoes not include: Religious organizations",
"post_approval_required": false
},
{
"code": "PROXY",
"name": "Proxy",
"description": "Peer-to-peer app-based group messaging with proxy/pooled numbers (For example: GroupMe)\\nSupporting personalized services and non-exposure of personal numbers for enterprise or A2P communications. (Examples include: Uber and AirBnb.)",
"post_approval_required": true
},
{
"code": "CUSTOMER_CARE",
"name": "Customer Care",
"description": "All customer care messaging, including account management and support",
"post_approval_required": false
},
{
"code": "DELIVERY_NOTIFICATION",
"name": "Delivery Notification",
"description": "Information about the status of the delivery of a product or service",
"post_approval_required": false
},
{
"code": "EMERGENCY",
"name": "Emergency",
"description": "Notification services designed to support public safety / health during natural disasters, armed conflicts, pandemics and other national or regional emergencies",
"post_approval_required": true
},
{
"code": "FRAUD_ALERT",
"name": "Fraud Alert Messaging",
"description": "Fraud alert notification",
"post_approval_required": false
},
{
"code": "HIGHER_EDUCATION",
"name": "Higher Education",
"description": "For campaigns created on behalf of Colleges or Universities and will also include School Districts etc that fall outside of any \\"free to the consumer\\" messaging model",
"post_approval_required": false
},
{
"code": "K12_EDUCATION",
"name": "K-12 Education",
"description": "Campaigns created for messaging platforms that support schools from grades K-12 and distance learning centers. This is not for Post-Secondary schools.",
"post_approval_required": true
},
{
"code": "LOW_VOLUME",
"name": "Low Volume Mixed",
"description": "Low throughput, any combination of use-cases. Examples include: test, demo accounts",
"post_approval_required": false
},
{
"code": "MARKETING",
"name": "Marketing",
"description": "Any communication with marketing and/or promotional content",
"post_approval_required": false
},
{
"code": "MIXED",
"name": "Mixed",
"description": "Mixed messaging reserved for specific consumer service industry",
"post_approval_required": false
},
{
"code": "POLITICAL",
"name": "Political",
"description": "Part of organized effort to influence decision making of specific group. All campaigns to be verified",
"post_approval_required": false
},
{
"code": "POLLING_VOTING",
"name": "Polling and voting",
"description": "Polling and voting",
"post_approval_required": false
},
{
"code": "PUBLIC_SERVICE_ANNOUNCEMENT",
"name": "Public Service Announcement",
"description": "An informational message that is meant to raise the audience awareness about an important issue",
"post_approval_required": false
},
{
"code": "SECURITY_ALERT",
"name": "Security Alert",
"description": "A notification that the security of a system, either software or hardware, has been compromised in some way and there is an action you need to take",
"post_approval_required": false
},
{
"code": "SOCIAL",
"name": "Social",
"description": "Communication within or between closed communities (For example: influencers alerts)",
"post_approval_required": true
},
{
"code": "SWEEPSTAKE",
"name": "Sweepstake",
"description": "Sweepstake",
"post_approval_required": true
}
]
}
'''
))
actual = self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
.us_app_to_person_usecases.fetch()
self.assertIsNotNone(actual)
def test_fetch_without_brand_registration_sid_response(self):
self.holodeck.mock(Response(
200,
'''
{
"us_app_to_person_usecases": [
{
"code": "2FA",
"name": "Two-Factor authentication (2FA)",
"description": "Two-Factor authentication, one-time use password, password reset",
"post_approval_required": false
},
{
"code": "ACCOUNT_NOTIFICATION",
"name": "Account Notification",
"description": "All reminders, alerts, and notifications. (Examples include: flight delayed, hotel booked, appointment reminders.)",
"post_approval_required": false
},
{
"code": "AGENTS_FRANCHISES",
"name": "Agents and Franchises",
"description": "For brands that have multiple agents, franchises or offices in the same brand vertical, but require individual localised numbers per agent/location/office.",
"post_approval_required": true
},
{
"code": "CHARITY",
"name": "Charity",
"description": "Includes: 5013C Charity\\nDoes not include: Religious organizations",
"post_approval_required": false
},
{
"code": "PROXY",
"name": "Proxy",
"description": "Peer-to-peer app-based group messaging with proxy/pooled numbers (For example: GroupMe)\\nSupporting personalized services and non-exposure of personal numbers for enterprise or A2P communications. (Examples include: Uber and AirBnb.)",
"post_approval_required": true
},
{
"code": "CUSTOMER_CARE",
"name": "Customer Care",
"description": "All customer care messaging, including account management and support",
"post_approval_required": false
},
{
"code": "DELIVERY_NOTIFICATION",
"name": "Delivery Notification",
"description": "Information about the status of the delivery of a product or service",
"post_approval_required": false
},
{
"code": "EMERGENCY",
"name": "Emergency",
"description": "Notification services designed to support public safety / health during natural disasters, armed conflicts, pandemics and other national or regional emergencies",
"post_approval_required": true
},
{
"code": "FRAUD_ALERT",
"name": "Fraud Alert Messaging",
"description": "Fraud alert notification",
"post_approval_required": false
},
{
"code": "HIGHER_EDUCATION",
"name": "Higher Education",
"description": "For campaigns created on behalf of Colleges or Universities and will also include School Districts etc that fall outside of any \\"free to the consumer\\" messaging model",
"post_approval_required": false
},
{
"code": "K12_EDUCATION",
"name": "K-12 Education",
"description": "Campaigns created for messaging platforms that support schools from grades K-12 and distance learning centers. This is not for Post-Secondary schools.",
"post_approval_required": true
},
{
"code": "LOW_VOLUME",
"name": "Low Volume Mixed",
"description": "Low throughput, any combination of use-cases. Examples include: test, demo accounts",
"post_approval_required": false
},
{
"code": "MARKETING",
"name": "Marketing",
"description": "Any communication with marketing and/or promotional content",
"post_approval_required": false
},
{
"code": "MIXED",
"name": "Mixed",
"description": "Mixed messaging reserved for specific consumer service industry",
"post_approval_required": false
},
{
"code": "POLITICAL",
"name": "Political",
"description": "Part of organized effort to influence decision making of specific group. All campaigns to be verified",
"post_approval_required": false
},
{
"code": "POLLING_VOTING",
"name": "Polling and voting",
"description": "Polling and voting",
"post_approval_required": false
},
{
"code": "PUBLIC_SERVICE_ANNOUNCEMENT",
"name": "Public Service Announcement",
"description": "An informational message that is meant to raise the audience awareness about an important issue",
"post_approval_required": false
},
{
"code": "SECURITY_ALERT",
"name": "Security Alert",
"description": "A notification that the security of a system, either software or hardware, has been compromised in some way and there is an action you need to take",
"post_approval_required": false
},
{
"code": "SOCIAL",
"name": "Social",
"description": "Communication within or between closed communities (For example: influencers alerts)",
"post_approval_required": true
},
{
"code": "SWEEPSTAKE",
"name": "Sweepstake",
"description": "Sweepstake",
"post_approval_required": true
}
]
}
'''
))
actual = self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
.us_app_to_person_usecases.fetch()
self.assertIsNotNone(actual)
|