本文整理汇总了Python中jasmin.routing.router.RouterPB.perspective_user_add方法的典型用法代码示例。如果您正苦于以下问题:Python RouterPB.perspective_user_add方法的具体用法?Python RouterPB.perspective_user_add怎么用?Python RouterPB.perspective_user_add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jasmin.routing.router.RouterPB
的用法示例。
在下文中一共展示了RouterPB.perspective_user_add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RouterPBTestCases
# 需要导入模块: from jasmin.routing.router import RouterPB [as 别名]
# 或者: from jasmin.routing.router.RouterPB import perspective_user_add [as 别名]
class RouterPBTestCases(TestCase):
def setUp(self):
# Initiating config objects without any filename
# will lead to setting defaults and that's what we
# need to run the tests
self.routerpb_config = RouterPBConfig()
# Instanciate RouterPB but will not launch a server
# we only need the instance to access its .users attribute
# for authentication
self.routerpb_factory = RouterPB(self.routerpb_config, persistenceTimer=False)
# Provision a user and default route into RouterPB
self.foo = User('u1', Group('test'), 'username', 'password')
self.c1 = SmppClientConnector(id_generator())
self.defaultroute = DefaultRoute(self.c1)
self.provision_user_defaultroute(user = self.foo, defaultroute = self.defaultroute)
def provision_user_defaultroute(self, user, defaultroute = None):
# This is normally done through jcli API (or any other high level API to come)
# Using perspective_user_add() is just a shortcut for testing purposes
if user.group not in self.routerpb_factory.groups:
self.routerpb_factory.perspective_group_add(pickle.dumps(user.group, pickle.HIGHEST_PROTOCOL))
self.routerpb_factory.perspective_user_add(pickle.dumps(user, pickle.HIGHEST_PROTOCOL))
# provision route
if defaultroute is not None:
self.routerpb_factory.perspective_mtroute_add(pickle.dumps(defaultroute, pickle.HIGHEST_PROTOCOL), 0)