本文整理汇总了Python中jasmin.routing.jasminApi.MtMessagingCredential.setAuthorization方法的典型用法代码示例。如果您正苦于以下问题:Python MtMessagingCredential.setAuthorization方法的具体用法?Python MtMessagingCredential.setAuthorization怎么用?Python MtMessagingCredential.setAuthorization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jasmin.routing.jasminApi.MtMessagingCredential
的用法示例。
在下文中一共展示了MtMessagingCredential.setAuthorization方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_authorization
# 需要导入模块: from jasmin.routing.jasminApi import MtMessagingCredential [as 别名]
# 或者: from jasmin.routing.jasminApi.MtMessagingCredential import setAuthorization [as 别名]
def test_authorization(self):
_cred = MtMessagingCredential()
_cred.setAuthorization('http_send', False)
# Assert User adding
extraCommands = [{'command': 'uid user_1'},
{'command': 'mt_messaging_cred authorization http_send no'}]
self.add_user(r'jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
# Assert User updating
_cred.setAuthorization('http_send', True)
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred authorization http_send 1'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
示例2: test_all
# 需要导入模块: from jasmin.routing.jasminApi import MtMessagingCredential [as 别名]
# 或者: from jasmin.routing.jasminApi.MtMessagingCredential import setAuthorization [as 别名]
def test_all(self):
_cred = MtMessagingCredential()
_cred.setAuthorization('http_send', False)
_cred.setAuthorization('http_long_content', False)
_cred.setAuthorization('set_dlr_level', False)
_cred.setAuthorization('http_set_dlr_method', False)
_cred.setAuthorization('set_source_address', False)
_cred.setAuthorization('set_priority', False)
_cred.setAuthorization('set_validity_period', False)
_cred.setValueFilter('destination_address', '^HELLO$')
_cred.setValueFilter('source_address', '^World$')
_cred.setValueFilter('priority', '^1$')
_cred.setValueFilter('validity_period', '^1$')
_cred.setValueFilter('content', '[0-9].*')
_cred.setDefaultValue('source_address', 'BRAND NAME')
_cred.setQuota('balance', 40.3)
_cred.setQuota('http_throughput', 2.2)
_cred.setQuota('smpps_throughput', 0.5)
# Assert User adding
extraCommands = [{'command': 'uid user_1'},
{'command': 'mt_messaging_cred Authorization http_send no'},
{'command': 'mt_messaging_cred authorization http_long_content n'},
{'command': 'mt_messaging_cred authorization dlr_level 0'},
{'command': 'mt_messaging_cred authorization http_dlr_method NO'},
{'command': 'mt_messaging_cred authorization src_addr false'},
{'command': 'mt_messaging_cred authorization priority f'},
{'command': 'mt_messaging_cred authorization validity_period f'},
{'command': 'mt_messaging_cred Valuefilter dst_addr ^HELLO$'},
{'command': 'mt_messaging_cred valuefilter src_addr ^World$'},
{'command': 'mt_messaging_cred valuefilter priority ^1$'},
{'command': 'mt_messaging_cred valuefilter validity_period ^1$'},
{'command': 'mt_messaging_cred valuefilter content [0-9].*'},
{'command': 'mt_messaging_cred Defaultvalue src_addr BRAND NAME'},
{'command': 'mt_messaging_cred Quota balance 40.3'},
{'command': 'mt_messaging_cred quota http_throughput 2.2'},
{'command': 'mt_messaging_cred quota smpps_throughput 0.5'},
]
self.add_user(r'jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
# Assert User updating
_cred.setAuthorization('http_send', True)
_cred.setAuthorization('http_long_content', True)
_cred.setAuthorization('set_dlr_level', True)
_cred.setAuthorization('http_set_dlr_method', True)
_cred.setAuthorization('set_source_address', True)
_cred.setAuthorization('set_priority', True)
_cred.setAuthorization('set_validity_period', True)
_cred.setValueFilter('destination_address', '^WORLD$')
_cred.setValueFilter('source_address', '^HELLO$')
_cred.setValueFilter('priority', '^2$')
_cred.setValueFilter('validity_period', '^2$')
_cred.setValueFilter('content', '[2-6].*')
_cred.setDefaultValue('source_address', 'SEXY NAME')
_cred.setQuota('balance', 66)
extraCommands = [{'command': 'mt_messaging_cred authorization http_send yes'},
{'command': 'mt_messaging_cred authorization http_long_content y'},
{'command': 'mt_messaging_cred authorization dlr_level 1'},
{'command': 'mt_messaging_cred authorization http_dlr_method YES'},
{'command': 'mt_messaging_cred authorization src_addr true'},
{'command': 'mt_messaging_cred authorization priority t'},
{'command': 'mt_messaging_cred authorization validity_period t'},
{'command': 'mt_messaging_cred valuefilter dst_addr ^WORLD$'},
{'command': 'mt_messaging_cred valuefilter src_addr ^HELLO$'},
{'command': 'mt_messaging_cred valuefilter priority ^2$'},
{'command': 'mt_messaging_cred valuefilter validity_period ^2$'},
{'command': 'mt_messaging_cred valuefilter content [2-6].*'},
{'command': 'mt_messaging_cred defaultvalue src_addr SEXY NAME'},
{'command': 'mt_messaging_cred quota balance 66'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)