当前位置: 首页>>代码示例>>Python>>正文


Python MtMessagingCredential.setQuota方法代码示例

本文整理汇总了Python中jasmin.routing.jasminApi.MtMessagingCredential.setQuota方法的典型用法代码示例。如果您正苦于以下问题:Python MtMessagingCredential.setQuota方法的具体用法?Python MtMessagingCredential.setQuota怎么用?Python MtMessagingCredential.setQuota使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jasmin.routing.jasminApi.MtMessagingCredential的用法示例。


在下文中一共展示了MtMessagingCredential.setQuota方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_all

# 需要导入模块: from jasmin.routing.jasminApi import MtMessagingCredential [as 别名]
# 或者: from jasmin.routing.jasminApi.MtMessagingCredential import setQuota [as 别名]
    def test_all(self):
        _cred = MtMessagingCredential()
        _cred.setAuthorization('http_send', False)
        _cred.setAuthorization('long_content', False)
        _cred.setAuthorization('set_dlr_level', False)
        _cred.setAuthorization('set_dlr_method', False)
        _cred.setAuthorization('set_source_address', False)
        _cred.setAuthorization('set_priority', False)
        _cred.setValueFilter('destination_address', '^HELLO$')
        _cred.setValueFilter('source_address', '^World$')
        _cred.setValueFilter('priority', '^1$')
        _cred.setValueFilter('content', '[0-9].*')
        _cred.setDefaultValue('source_address', 'BRAND NAME')
        _cred.setQuota('balance', 40.3)

        # Assert User adding
        extraCommands = [{'command': 'uid user_1'},
                         {'command': 'mt_messaging_cred authorization http_send no'},
                         {'command': 'mt_messaging_cred authorization long_content n'},
                         {'command': 'mt_messaging_cred authorization dlr_level 0'},
                         {'command': 'mt_messaging_cred authorization dlr_method NO'},
                         {'command': 'mt_messaging_cred authorization src_addr false'},
                         {'command': 'mt_messaging_cred authorization priority 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 content [0-9].*'},
                         {'command': 'mt_messaging_cred defaultvalue src_addr BRAND NAME'},
                         {'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.setAuthorization('http_send', True)
        _cred.setAuthorization('long_content', True)
        _cred.setAuthorization('set_dlr_level', True)
        _cred.setAuthorization('set_dlr_method', True)
        _cred.setAuthorization('set_source_address', True)
        _cred.setAuthorization('set_priority', True)
        _cred.setValueFilter('destination_address', '^WORLD$')
        _cred.setValueFilter('source_address', '^HELLO$')
        _cred.setValueFilter('priority', '^2$')
        _cred.setValueFilter('content', '[2-6].*')
        _cred.setDefaultValue('source_address', 'SEXY NAME')
        _cred.setQuota('balance', 66)
        extraCommands = [{'command': 'password anypassword'},
                         {'command': 'mt_messaging_cred authorization http_send yes'},
                         {'command': 'mt_messaging_cred authorization long_content y'},
                         {'command': 'mt_messaging_cred authorization dlr_level 1'},
                         {'command': 'mt_messaging_cred authorization dlr_method YES'},
                         {'command': 'mt_messaging_cred authorization src_addr true'},
                         {'command': 'mt_messaging_cred authorization priority 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 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)
开发者ID:AlternativeValue-ALVA,项目名称:jasmin,代码行数:62,代码来源:test_userm.py

示例2: test_quota

# 需要导入模块: from jasmin.routing.jasminApi import MtMessagingCredential [as 别名]
# 或者: from jasmin.routing.jasminApi.MtMessagingCredential import setQuota [as 别名]
    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)
开发者ID:AndreiPlesa,项目名称:jasmin,代码行数:18,代码来源:test_userm.py

示例3: test_increase_decrease_quota_int

# 需要导入模块: from jasmin.routing.jasminApi import MtMessagingCredential [as 别名]
# 或者: from jasmin.routing.jasminApi.MtMessagingCredential import setQuota [as 别名]
    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)
开发者ID:AndreiPlesa,项目名称:jasmin,代码行数:19,代码来源:test_userm.py

示例4: test_increase_decrease_quota_invalid_type

# 需要导入模块: from jasmin.routing.jasminApi import MtMessagingCredential [as 别名]
# 或者: from jasmin.routing.jasminApi.MtMessagingCredential import setQuota [as 别名]
    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)
开发者ID:AndreiPlesa,项目名称:jasmin,代码行数:20,代码来源:test_userm.py

示例5: test_increase_unlimited_quota

# 需要导入模块: from jasmin.routing.jasminApi import MtMessagingCredential [as 别名]
# 或者: from jasmin.routing.jasminApi.MtMessagingCredential import setQuota [as 别名]
    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)
开发者ID:AVert,项目名称:jasmin,代码行数:20,代码来源:test_userm.py


注:本文中的jasmin.routing.jasminApi.MtMessagingCredential.setQuota方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。