本文整理汇总了Python中multiproduct.model.Product.prefix方法的典型用法代码示例。如果您正苦于以下问题:Python Product.prefix方法的具体用法?Python Product.prefix怎么用?Python Product.prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiproduct.model.Product
的用法示例。
在下文中一共展示了Product.prefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_insert_into_multiple_products
# 需要导入模块: from multiproduct.model import Product [as 别名]
# 或者: from multiproduct.model.Product import prefix [as 别名]
def test_insert_into_multiple_products(self):
# UIDs are global, autoincremented
# IDs are product-scoped, incremented in the SQL translator
self.env = ProductEnvironment(self.global_env, self.default_product)
tid = self._insert_ticket('hello kitty', reporter='admin')
ticket = Ticket(self.env, tid)
self.assertEqual(tid, 1)
self.assertEqual(self._get_ticket_uid(tid), 1)
self.assertEqual(ticket.id, tid)
tid = self._insert_ticket('hello kitteh', reporter='admin')
ticket = Ticket(self.env, tid)
self.assertEqual(tid, 2)
self.assertEqual(self._get_ticket_uid(tid), 2)
self.assertEqual(ticket.id, tid)
p2 = Product(self.global_env)
p2.prefix = 'p2'
p2.name = 'product, too'
p2.owner = 'admin'
p2.insert()
self.env = ProductEnvironment(self.global_env, p2)
tid = self._insert_ticket('hello catty', reporter='admin')
ticket = Ticket(self.env, tid)
self.assertEqual(tid, 1)
self.assertEqual(self._get_ticket_uid(tid), 3)
self.assertEqual(ticket.id, tid)
tid = self._insert_ticket('hello ocelot', reporter='admin')
ticket = Ticket(self.env, tid)
self.assertEqual(tid, 2)
self.assertEqual(self._get_ticket_uid(tid), 4)
self.assertEqual(ticket.id, tid)
示例2: test_set_table_field
# 需要导入模块: from multiproduct.model import Product [as 别名]
# 或者: from multiproduct.model.Product import prefix [as 别名]
def test_set_table_field(self):
"""tests that table.field style update works"""
test = {'prefix': 'td',
'name': 'test field access',
'description': 'product to test field setting'}
product = Product(self.env)
# attempt to set the fields from the data
product.prefix = test['prefix']
product.name = test['name']
product.description = test['description']
self.assertEqual(product._data['prefix'], test['prefix'])
self.assertEqual(product._data['name'], test['name'])
self.assertEqual(product._data['description'], test['description'])
示例3: test_new_product_perm
# 需要导入模块: from multiproduct.model import Product [as 别名]
# 或者: from multiproduct.model.Product import prefix [as 别名]
def test_new_product_perm(self):
"""Only product owner and TRAC_ADMIN will access new product
"""
newproduct = Product(self.global_env)
newproduct.prefix = 'NEW'
newproduct.name = 'New product'
newproduct.owner = 'owneruser'
newproduct.insert()
env = ProductEnvironment(self.global_env, newproduct)
self.global_perm_admin._do_add('adminuser', 'TRAC_ADMIN')
admin_perm = perm.PermissionCache(env, 'adminuser')
owner_perm = perm.PermissionCache(env, 'owneruser')
user_perm = perm.PermissionCache(env, 'testuser')
global_permsys = perm.PermissionSystem(self.global_env)
permsys = perm.PermissionSystem(env)
self.assertEquals({'EMAIL_VIEW': True, 'TEST_ADMIN': True,
'TEST_CREATE': True, 'TEST_DELETE': True,
'TEST_MODIFY': True, 'TRAC_ADMIN' : True},
global_permsys.get_user_permissions('adminuser'))
self.assertEquals({}, global_permsys.get_user_permissions('owneruser'))
self.assertEquals({}, global_permsys.get_user_permissions('testuser'))
self.assertEquals({}, permsys.get_user_permissions('adminuser'))
self.assertEquals({}, permsys.get_user_permissions('owneruser'))
self.assertEquals({}, permsys.get_user_permissions('testuser'))
all_actions = self.permsys.get_actions()
all_actions.remove('TRAC_ADMIN')
for action in all_actions:
self.assertTrue(admin_perm.has_permission(action))
self.assertTrue(owner_perm.has_permission(action))
self.assertFalse(user_perm.has_permission(action))
self.assertTrue(admin_perm.has_permission('TRAC_ADMIN'))
self.assertFalse(owner_perm.has_permission('TRAC_ADMIN'))
self.assertFalse(user_perm.has_permission('TRAC_ADMIN'))