@@ -49,12 +49,15 @@ def test_generate_token_custom_ttl(self):
49
49
self .assertIsNotNone (decoded )
50
50
self .assertEqual (int (time .time ()) + 10000 , decoded ['exp' ])
51
51
52
- def test_websockets_allowed (self ):
52
+ def test_defaults (self ):
53
53
token = self .cap .generate_token ()
54
54
decoded = jwt .decode (token , self .auth_token )
55
55
56
56
self .assertIsNotNone (decoded )
57
- websocket_url = 'https://event-bridge.twilio.com/v1/wschannels/%s/%s' % (self .account_sid , self .worker_sid )
57
+ websocket_url = (
58
+ 'https://event-bridge.twilio.com/v1/wschannels/%s/%s' %
59
+ (self .account_sid , self .worker_sid )
60
+ )
58
61
expected = [
59
62
{
60
63
'url' : websocket_url ,
@@ -70,6 +73,14 @@ def test_websockets_allowed(self):
70
73
'query_filter' : {},
71
74
'post_filter' : {},
72
75
},
76
+ {
77
+ 'url' :
78
+ 'https://taskrouter.twilio.com/v1/Workspaces/WS456/Activities' ,
79
+ 'method' : 'GET' ,
80
+ 'allow' : True ,
81
+ 'query_filter' : {},
82
+ 'post_filter' : {},
83
+ },
73
84
]
74
85
self .assertEqual (expected , decoded ['policies' ])
75
86
@@ -79,8 +90,7 @@ def test_allow_worker_activity_updates(self):
79
90
decoded = jwt .decode (token , self .auth_token )
80
91
81
92
self .assertIsNotNone (decoded )
82
- url = 'https://taskrouter.twilio.com/v1/Accounts/%s/Workspaces/%s/Workers/%s' % (
83
- self .account_sid ,
93
+ url = 'https://taskrouter.twilio.com/v1/Workspaces/%s/Workers/%s' % (
84
94
self .workspace_sid ,
85
95
self .worker_sid ,
86
96
)
@@ -92,16 +102,15 @@ def test_allow_worker_activity_updates(self):
92
102
'query_filter' : {},
93
103
'post_filter' : {'ActivitySid' : {'required' : True }},
94
104
}
95
- self .assertEqual (expected , decoded ['policies' ][2 ])
105
+ self .assertEqual (expected , decoded ['policies' ][- 1 ])
96
106
97
107
def test_allow_worker_fetch_attributes (self ):
98
108
self .cap .allow_worker_fetch_attributes ()
99
109
token = self .cap .generate_token ()
100
110
decoded = jwt .decode (token , self .auth_token )
101
111
102
112
self .assertIsNotNone (decoded )
103
- url = 'https://taskrouter.twilio.com/v1/Accounts/%s/Workspaces/%s/Workers/%s' % (
104
- self .account_sid ,
113
+ url = 'https://taskrouter.twilio.com/v1/Workspaces/%s/Workers/%s' % (
105
114
self .workspace_sid ,
106
115
self .worker_sid ,
107
116
)
@@ -114,16 +123,15 @@ def test_allow_worker_fetch_attributes(self):
114
123
'post_filter' : {},
115
124
}
116
125
117
- self .assertEqual (expected , decoded ['policies' ][2 ])
126
+ self .assertEqual (expected , decoded ['policies' ][- 1 ])
118<
8000
/code>
127
119
128
def test_allow_task_reservation_updates (self ):
120
129
self .cap .allow_task_reservation_updates ()
121
130
token = self .cap .generate_token ()
122
131
decoded = jwt .decode (token , self .auth_token )
123
132
124
133
self .assertIsNotNone (decoded )
125
- url = 'https://taskrouter.twilio.com/v1/Accounts/%s/Workspaces/%s/Tasks/**' % (
126
- self .account_sid ,
134
+ url = 'https://taskrouter.twilio.com/v1/Workspaces/%s/Tasks/**' % (
127
135
self .workspace_sid ,
128
136
)
129
137
@@ -134,4 +142,4 @@ def test_allow_task_reservation_updates(self):
134
142
'query_filter' : {},
135
143
'post_filter' : {'ReservationStatus' : {'required' : True }},
136
144
}
137
- self .assertEqual (expected , decoded ['policies' ][2 ])
145
+ self .assertEqual (expected , decoded ['policies' ][- 1 ])
0 commit comments