本文整理汇总了Python中treemap.tests.make_user函数的典型用法代码示例。如果您正苦于以下问题:Python make_user函数的具体用法?Python make_user怎么用?Python make_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_user函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.instance = make_instance()
self.user = make_user(username='user')
self.instance_user = make_user(self.instance, 'instance_user')
self.client.get('/accounts/logout/')
示例2: setUp
def setUp(self):
self.user = make_user(username='test', password='password')
self.instance = make_instance()
# Create an admin user to verify that not all admins get notifications
self.admin = make_user(instance=self.instance, username='admin',
admin=True)
示例3: test_plot_is_writable_if_can_create_tree
def test_plot_is_writable_if_can_create_tree(self):
self.commander_user = make_commander_user(self.instance)
self.commander_role = \
self.commander_user.get_instance_user(self.instance).role
self.tree_only_user = make_user(self.instance)
self.tree_only_role = self.instance.default_role
content_type = ContentType.objects.get_for_model(Tree)
add_tree_perm = Permission.objects.get(content_type=content_type,
codename='add_tree')
self.tree_only_role.instance_permissions.add(add_tree_perm)
self.tree_only_role.save()
self.p = Point(-8515941.0, 4953519.0)
self.plot = Plot(instance=self.instance, width=12, geom=self.p)
self.plot.save_with_user(self.commander_user)
plot2 = Plot(instance=self.instance, width=12, geom=self.p)
self.assertRaises(AuthorizeException,
plot2.save_with_user,
self.tree_only_user)
self.tree = Tree(instance=self.instance, plot=self.plot)
self.tree.save_with_user(self.tree_only_user)
self.assertTrue(self.tree.user_can_create(self.tree_only_user))
# The plot should be writable if the user can create a tree
self.assertTrue(perms.map_feature_is_writable(
self.tree_only_role,
self.plot))
示例4: setUp
def setUp(self):
self.instance = make_instance()
self.user = make_user(username='user', password='user')
self.role = Role(name='role', instance=self.instance, rep_thresh=0)
self.role.save()
self.user_perm, __ = FieldPermission.objects.get_or_create(
model_name='Plot', field_name='width',
permission_level=FieldPermission.NONE,
role=self.role, instance=self.instance)
iuser = InstanceUser(instance=self.instance, user=self.user,
role=self.role)
iuser.save_with_user(self.user)
inst_role = Role(name='inst def role',
instance=self.instance,
rep_thresh=0)
inst_role.save()
self.inst_perm, __ = FieldPermission.objects.get_or_create(
model_name='Plot', field_name='width',
permission_level=FieldPermission.NONE,
role=inst_role, instance=self.instance)
self.instance.default_role = inst_role
self.instance.save()
self.plot = Plot(instance=self.instance)
示例5: setUp
def setUp(self):
create_mock_system_user()
super(LoginLogoutTest, self).setUp()
self.user = make_user(username='username', password='password')
self.profile = RegistrationProfile.objects.create_profile(self.user)
示例6: setUp
def setUp(self):
clear_caches()
self.instance = make_instance()
self.user = make_commander_user(self.instance)
self.role = self.user.get_role(self.instance)
self.simple_user = make_user()
default_role = self.instance.default_role
FieldPermission(model_name='Plot', field_name='owner_orig_id',
role=default_role, instance=self.instance,
permission_level=READ).save()
示例7: setUp
def setUp(self):
self.instance = make_instance(name='Test Instance')
self.species = Species(instance=self.instance,
common_name='Test Common Name',
genus='Test Genus',
cultivar='Test Cultivar',
species='Test Species')
self.species.save_base()
self.user = make_user(username='commander', password='pw')
self.import_event = ImportEvent(imported_by=self.user)
self.import_event.save_base()
self.plot = Plot(geom=Point(0, 0), instance=self.instance,
address_street="123 Main Street")
self.plot.save_base()
self.tree = Tree(plot=self.plot, instance=self.instance)
self.tree.save_base()
self.boundary = make_simple_boundary("Test Boundary")
self.role = make_commander_role(self.instance)
self.role.name = "Test Role"
self.role.save()
self.field_permission = FieldPermission(
model_name="Tree",
field_name="readonly",
permission_level=FieldPermission.READ_ONLY,
role=self.role,
instance=self.instance)
self.field_permission.save_base()
self.audit = Audit(action=Audit.Type.Update,
model="Tree",
field="readonly",
model_id=1,
user=self.user,
previous_value=True,
current_value=False)
self.audit.save_base()
self.reputation_metric = ReputationMetric(instance=self.instance,
model_name="Tree",
action="Test Action")
self.reputation_metric.save_base()
示例8: setUp
def setUp(self):
self.user = make_user(username='WALL-E', password='EVE')
示例9: test_udf_sets_is_editable_to_true_for_user_with_perms
def test_udf_sets_is_editable_to_true_for_user_with_perms(self):
user = make_user(self.instance, username='udf_user',
make_role=lambda _: self.udf_role)
self.assert_plot_udf_context_value(user, 'field.is_editable', 'True')
示例10: test_udf_sets_is_editable_to_false_for_user_without_perms
def test_udf_sets_is_editable_to_false_for_user_without_perms(self):
user = make_user(username='testuser')
self.assert_plot_udf_context_value(user, 'field.is_editable', 'False')
示例11: test_udf_sets_is_visible_to_true_for_user_with_perms
def test_udf_sets_is_visible_to_true_for_user_with_perms(self):
user = make_user(self.instance, username="udf_user", make_role=lambda _: self.udf_role)
self.assert_plot_udf_context_value(user, "field.is_visible", "True")
示例12: test_get_instance_user_fails
def test_get_instance_user_fails(self):
user = make_user(username="joe", password="pw")
self.assertEqual(user.get_instance_user(self.instance), None)
示例13: setUp
def setUp(self):
self.instance = make_instance()
self.user = make_user(username="someone", password="someone")
self.public_user = make_user(username="public", password="public")