本文整理汇总了Python中jasmin.routing.jasminApi.MtMessagingCredential类的典型用法代码示例。如果您正苦于以下问题:Python MtMessagingCredential类的具体用法?Python MtMessagingCredential怎么用?Python MtMessagingCredential使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MtMessagingCredential类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_quota
def test_quota(self):
_cred = MtMessagingCredential()
_cred.setQuota('balance', 40.3)
# Assert User adding
extraCommands = [{'command': 'uid user_1'},
{'command': 'mt_messaging_cred quota balance 40.3'}]
self.add_user(r'jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
# Assert User updating
_cred.setQuota('balance', 42)
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred quota balance 42'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
示例2: test_defaultvalue
def test_defaultvalue(self):
_cred = MtMessagingCredential()
_cred.setDefaultValue('source_address', 'World')
# Assert User adding
extraCommands = [{'command': 'uid user_1'},
{'command': 'mt_messaging_cred defaultvalue src_addr World'}]
self.add_user(r'jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
# Assert User updating
_cred.setDefaultValue('source_address', 'HELLO')
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred defaultvalue src_addr HELLO'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
示例3: test_valuefilter
def test_valuefilter(self):
_cred = MtMessagingCredential()
_cred.setValueFilter('content', '^HELLO$')
# Assert User adding
extraCommands = [{'command': 'uid user_1'},
{'command': 'mt_messaging_cred valuefilter content ^HELLO$'}]
self.add_user(r'jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
# Assert User updating
_cred.setValueFilter('content', '^WORLD$')
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred valuefilter content ^WORLD$'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
示例4: test_authorization
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)
示例5: test_increase_decrease_quota_int
def test_increase_decrease_quota_int(self):
# Add with initial quota
extraCommands = [{'command': 'uid user_1'},
{'command': 'mt_messaging_cred quota sms_count 100'}]
self.add_user(r'jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')
_cred = MtMessagingCredential()
_cred.setQuota('submit_sm_count', 20)
# Assert User increasing/decreasing quota
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred quota sms_count -90'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred quota sms_count +10'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
示例6: test_increase_decrease_quota_invalid_type
def test_increase_decrease_quota_invalid_type(self):
# Add with initial quota
extraCommands = [{'command': 'uid user_1'},
{'command': 'mt_messaging_cred quota sms_count 100'}]
self.add_user(r'jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')
# Quota will remain the same since the following updates are using incorrect type
_cred = MtMessagingCredential()
_cred.setQuota('submit_sm_count', 100)
# Assert User increasing/decreasing quota
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred quota sms_count -90.2'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred quota sms_count +10.2'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
示例7: test_increase_unlimited_quota
def test_increase_unlimited_quota(self):
"Related to #403"
# Add user without initial quota
extraCommands = [{'command': 'uid user_1'}]
self.add_user(r'jcli : ', extraCommands, GID = 'AnyGroup', Username = 'AnyUsername')
_cred = MtMessagingCredential()
_cred.setQuota('submit_sm_count', 20)
_cred.setQuota('balance', 11.2)
# Assert User increasing/decreasing quota
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred quota sms_count +20'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
extraCommands = [{'command': 'password anypassword'},
{'command': 'mt_messaging_cred quota balance +11.2'}]
self.update_user(r'jcli : ', 'user_1', extraCommands)
self._test_user_with_MtMessagingCredential('user_1', 'AnyGroup', 'AnyUsername', _cred)
示例8: test_all
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)