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


Python tests.make_commander_user函数代码示例

本文整理汇总了Python中treemap.tests.make_commander_user函数的典型用法代码示例。如果您正苦于以下问题:Python make_commander_user函数的具体用法?Python make_commander_user怎么用?Python make_commander_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setUp

    def setUp(self):
        super(UpdatedFieldsTest, self).setUp()

        self.point = Point(-8515941.0, 4953519.0)
        self.instance = make_instance(point=self.point)
        self.user = make_commander_user(self.instance)
        self.fellow = make_commander_user(self.instance, 'other-commander')
        self.plot = Plot(geom=self.point, instance=self.instance)
        self.plot.save_with_user(self.user)
        self.plot.refresh_from_db()
        self.initial_updated = self.plot.updated_at
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:11,代码来源:test_map_feature.py

示例2: setUp

    def setUp(self):
        self.instance = make_instance()
        self.commander = make_commander_user(self.instance, "comm")

        # Note unicode '⅀' is on purpose
        self.user1 = User(username='estraven', password='estraven',
                          email='[email protected]',
                          organization='org111',
                          first_name='therem', last_name='⅀straven')

        self.user1.save_with_user(self.commander)

        self.user2 = User(username='genly', password='genly',
                          email='[email protected]',
                          first_name='genly', last_name='ai')
        self.user2.save_with_user(self.commander)

        self.user3 = User(username='argaven_xv', password='argaven_xv',
                          email='[email protected]')
        self.user3.save_with_user(self.commander)

        self.user4 = User(username='faxe', password='faxe',
                          email='[email protected]')
        self.user4.save_with_user(self.commander)

        self.factory = RequestFactory()
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:26,代码来源:test_roles.py

示例3: setUp

    def setUp(self):
        region = ITreeRegion.objects.get(code='NoEastXXX')
        p = region.geometry.point_on_surface

        self.instance = make_instance(is_public=True, point=p)

        self.user = make_commander_user(self.instance)

        self.species = Species(otm_code='CEAT',
                               genus='cedrus',
                               species='atlantica',
                               max_dbh=2000,
                               max_height=100,
                               instance=self.instance)
        self.species.save_with_user(self.user)

        self.plot = Plot(geom=p, instance=self.instance)

        self.plot.save_with_user(self.user)

        self.tree = Tree(plot=self.plot,
                         instance=self.instance,
                         readonly=False,
                         species=self.species,
                         diameter=1630)

        self.tree.save_with_user(self.user)
开发者ID:ahinz,项目名称:OpenTreeMap-cloud,代码行数:27,代码来源:ecobenefits.py

示例4: test_user_audits

 def test_user_audits(self):
     self.instance = make_instance()
     username = make_commander_user(self.instance).username
     self.assert_template("/users/%s/edits/" % username, "treemap/recent_user_edits.html")
     self.assert_template(
         "/users/%s/edits/?instance_id=%s" % (username, self.instance.id), "treemap/recent_user_edits.html"
     )
开发者ID:heath,项目名称:OTM2,代码行数:7,代码来源:urls.py

示例5: setUp

    def setUp(self):
        self.p = Point(-8515941.0, 4953519.0)
        self.instances = [
            make_instance(point=self.p),
            make_instance(point=self.p)
        ]
        self.commander_users = [
            make_commander_user(i, username='commander%d' % i.pk)
            for i in self.instances]
        for i in range(len(self.instances)):
            set_write_permissions(self.instances[i], self.commander_users[i],
                                  'Plot', ['udf:Test choice'])
        self.choice_udfds = [
            UserDefinedFieldDefinition.objects.create(
                instance=i,
                model_type='Plot',
                datatype=json.dumps({'type': 'choice',
                                     'choices': ['a', 'b', 'c']}),
                iscollection=False,
                name='Test choice') for i in self.instances]

        self.plots = [
            Plot(geom=self.p, instance=i) for i in self.instances]

        for i in range(len(self.plots)):
            self.plots[i].save_with_user(self.commander_users[i])

        psycopg2.extras.register_hstore(connection.cursor(), globally=True)
开发者ID:riromu,项目名称:otm-core,代码行数:28,代码来源:test_udfs.py

示例6: 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))
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:31,代码来源:test_perms.py

示例7: setUp

 def setUp(self):
     self.instance = make_instance()
     self.user = make_commander_user(self.instance)
     self.plot = Plot(instance=self.instance, geom=self.instance.center)
     self.plot.save_with_user(self.user)
     self.tree = Tree(instance=self.instance, plot=self.plot)
     self.tree.save_with_user(self.user)
开发者ID:HackMichiana,项目名称:otm-core,代码行数:7,代码来源:test_units.py

示例8: setUp

    def setUp(self):
        self.p = Point(-7615441.0, 5953519.0)

        self.instance = make_instance(point=self.p)
        self.user = make_commander_user(self.instance)

        self.plot = Plot(geom=self.instance.center, instance=self.instance)
开发者ID:jwalgran,项目名称:otm-core,代码行数:7,代码来源:test_models.py

示例9: setUp

 def setUp(self):
     self.p1 = Point(0, 0)
     self.instance = make_instance(point=self.p1)
     self.commander = make_commander_user(self.instance)
     self.parse_dict_value = partial(
         search._parse_dict_value_for_mapping,
         search.PREDICATE_TYPES)
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:7,代码来源:test_search.py

示例10: setUp

 def setUp(self):
     self.instance = make_instance()
     self.user = make_commander_user(self.instance)
     self.plot = Plot(instance=self.instance, geom=Point(-7615441, 5953519))
     self.plot.save_with_user(self.user)
     self.tree = Tree(instance=self.instance, plot=self.plot)
     self.tree.save_with_user(self.user)
开发者ID:ahinz,项目名称:OpenTreeMap-cloud,代码行数:7,代码来源:units.py

示例11: setUp

 def setUp(self):
     super(CommentTestMixin, self).setUp()
     self.instance = make_instance()
     self.user = make_commander_user(self.instance)
     self.admin = make_admin_user(self.instance)
     self.plot = Plot(geom=self.instance.center, instance=self.instance)
     self.plot.save_with_user(self.user)
开发者ID:JoshIUSBStudent,项目名称:otm-core,代码行数:7,代码来源:tests.py

示例12: setupTreemapEnv

def setupTreemapEnv():
    def local_render_to_response(*args, **kwargs):
        from django.template import loader
        from django.http import HttpResponse

        httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}
        hr = HttpResponse(
            loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)

        if hasattr(args[1], 'dicts'):
            hr.request_context = args[1].dicts

        return hr

    django.shortcuts.render_to_response = local_render_to_response

    instance = make_instance(is_public=True)
    create_stewardship_udfs(instance)

    make_user_with_default_role(instance, 'jim')
    commander = make_commander_user(instance, 'commander')
    make_apprentice_user(instance, 'apprentice')

    n1geom = MultiPolygon(Polygon(
        ((0, 0), (100, 0), (100, 100), (0, 100), (0, 0))))

    n2geom = MultiPolygon(
        Polygon(((0, 101), (101, 101), (101, 200), (0, 200), (0, 101))))

    n1 = Boundary(name="n1", category='blah', sort_order=4, geom=n1geom)
    n2 = Boundary(name="n2", category='blah', sort_order=4, geom=n2geom)

    n1.save()
    n2.save()

    s1 = Species(otm_code="s1", genus="testus1", species="specieius1",
                 cultivar='', instance=instance)
    s2 = Species(otm_code="s2", genus="testus2", species="specieius2",
                 cultivar='', instance=instance)
    s3 = Species(otm_code="s3", genus="testus2", species="specieius3",
                 cultivar='', instance=instance)

    s1.is_native = True
    s1.fall_conspicuous = True
    s1.flower_conspicuous = True
    s1.palatable_human = True

    s2.is_native = True
    s2.fall_conspicuous = False
    s2.flower_conspicuous = True
    s2.palatable_human = False
    s2.has_wildlife_value = True

    s3.has_wildlife_value = True

    s1.save_with_user(commander)
    s2.save_with_user(commander)
    s3.save_with_user(commander)

    return instance
开发者ID:JoshIUSBStudent,项目名称:otm-core,代码行数:60,代码来源:test_utils.py

示例13: setUp

    def setUp(self):
        super(AsyncCSVTestCase, self).setUp()
        self.instance = make_instance()
        self.user = make_commander_user(self.instance)

        self.unprivileged_user = User.objects.create_user(username='foo',
                                                          email='[email protected]',
                                                          password='bar')
开发者ID:RickMohr,项目名称:otm-core,代码行数:8,代码来源:tests.py

示例14: setUp

 def setUp(self):
     self.point = Point(-8515941.0, 4953519.0)
     self.instance = make_instance(point=self.point)
     self.user = make_commander_user(self.instance)
     self.plot = Plot(geom=self.point, instance=self.instance)
     self.plot.save_with_user(self.user)
     self.plot = Plot.objects.get(pk=self.plot.pk)
     self.initial_updated = self.plot.updated_at
开发者ID:barbaralluz,项目名称:otm-core,代码行数:8,代码来源:test_map_feature.py

示例15: setUp

 def setUp(self):
     super(UpdatedAtTestCase, self).setUp()
     self.image = self.load_resource('tree1.gif')
     self.test_start = timezone.now()
     self.point = Point(-8515941.0, 4953519.0)
     self.instance = make_instance(point=self.point)
     self.user = make_commander_user(self.instance)
     self.plot = Plot(geom=self.point, instance=self.instance)
     self.plot.save_with_user(self.user)
开发者ID:HackMichiana,项目名称:otm-core,代码行数:9,代码来源:test_updated_at.py


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