|
4 | 4 | from datetime import datetime
|
5 | 5 | from nose.tools import assert_equal
|
6 | 6 | from twilio.jwt import decode
|
7 |
| -from twilio.access_token import AccessToken, ConversationsGrant, IpMessagingGrant, VoiceGrant |
| 7 | +from twilio.access_token import AccessToken, ConversationsGrant, IpMessagingGrant, VoiceGrant, VideoGrant |
8 | 8 |
|
9 | 9 | ACCOUNT_SID = 'AC123'
|
10 | 10 | SIGNING_KEY_SID = 'SK123'
|
@@ -93,18 +93,33 @@ def test_ip_messaging_grant(self):
|
93 | 93 | 'push_credential_sid': 'CR123'
|
94 | 94 | }, payload['grants']['ip_messaging'])
|
95 | 95 |
|
| 96 | + def test_video_grant(self): |
| 97 | + scat = AccessToken(ACCOUNT_SID, SIGNING_KEY_SID, 'secret') |
| 98 | + scat.add_grant(VideoGrant(configuration_profile_sid='CP123')) |
| 99 | + |
| 100 | + token = str(scat) |
| 101 | + assert_is_not_none(token) |
| 102 | + payload = decode(token, 'secret') |
| 103 | + self._validate_claims(payload) |
| 104 | + assert_equal(1, len(payload['grants'])) |
| 105 | + assert_equal({ |
| 106 | + 'configuration_profile_sid': 'CP123' |
| 107 | + }, payload['grants']['video']) |
| 108 | + |
96 | 109 | def test_grants(self):
|
97 | 110 | scat = AccessToken(ACCOUNT_SID, SIGNING_KEY_SID, 'secret')
|
98 | 111 | scat.add_grant(ConversationsGrant())
|
99 | 112 | scat.add_grant(IpMessagingGrant())
|
| 113 | + scat.add_grant(VideoGrant()) |
100 | 114 |
|
101 | 115 | token = str(scat)
|
102 | 116 | assert_is_not_none(token)
|
103 | 117 |
8000
payload = decode(token, 'secret')
|
104 | 118 | self._validate_claims(payload)
|
105 |
| - assert_equal(2, len(payload['grants'])) |
| 119 | + assert_equal(3, len(payload['grants'])) |
106 | 120 | assert_equal({}, payload['grants']['rtc'])
|
107 | 121 | assert_equal({}, payload['grants']['ip_messaging'])
|
| 122 | + assert_equal({}, payload['grants']['video']) |
108 | 123 |
|
109 | 124 | def test_programmable_voice_grant(self):
|
110 | 125 | grant = VoiceGrant(
|
|
0 commit comments