コード例 #1
0
ファイル: test_audit.py プロジェクト: RickMohr/otm-core
    def setUp(self):
        instance = make_instance()

        self.creator_user = make_officer_user(instance)
        self.admin_user = make_admin_user(instance)
        self.other_user = make_officer_user(instance, username='******')

        self.plot = Plot(geom=instance.center, instance=instance)
        self.plot.save_with_user(self.creator_user)

        self.tree = Tree(plot=self.plot, instance=instance)
        self.tree.save_with_user(self.creator_user)

        self.rainBarrel = RainBarrel(geom=instance.center, instance=instance,
                                     capacity=5)
        self.rainBarrel.save_with_user(self.creator_user)
コード例 #2
0
ファイル: test_audit.py プロジェクト: OpenTreeMap/otm-core
    def setUp(self):
        self.p1 = Point(-7615441.0, 5953519.0)
        self.instance = make_instance(point=self.p1)
        self.commander_user = make_commander_user(self.instance)
        self.direct_user = make_officer_user(self.instance)
        self.pending_user = make_apprentice_user(self.instance)
        self.observer_user = make_observer_user(self.instance)

        self.plot = Plot(geom=self.p1, instance=self.instance, length=5.0)
        self.plot.save_with_user(self.commander_user)
コード例 #3
0
ファイル: test_audit.py プロジェクト: OpenTreeMap/otm-core
 def setUp(self):
     self.p1 = Point(-7615441.0, 5953519.0)
     self.instance = make_instance(point=self.p1)
     self.commander_user = make_commander_user(self.instance)
     self.direct_user = make_officer_user(self.instance)
     self.pending_user = make_apprentice_user(self.instance)
     self.observer_user = make_observer_user(self.instance)
     self.outlaw_user = make_user_with_default_role(self.instance, 'outlaw')
     self.tweaker_user = make_tweaker_user(self.instance)
     self.conjurer_user = make_conjurer_user(self.instance)
コード例 #4
0
    def setUp(self):
        self.p1 = Point(-7615441.0, 5953519.0)
        self.instance = make_instance(point=self.p1)
        self.commander_user = make_commander_user(self.instance)
        self.direct_user = make_officer_user(self.instance)
        self.pending_user = make_apprentice_user(self.instance)
        self.observer_user = make_observer_user(self.instance)

        self.plot = Plot(geom=self.p1, instance=self.instance, length=5.0)
        self.plot.save_with_user(self.commander_user)
コード例 #5
0
 def setUp(self):
     self.p1 = Point(-7615441.0, 5953519.0)
     self.instance = make_instance(point=self.p1)
     self.commander_user = make_commander_user(self.instance)
     self.direct_user = make_officer_user(self.instance)
     self.pending_user = make_apprentice_user(self.instance)
     self.observer_user = make_observer_user(self.instance)
     self.outlaw_user = make_user_with_default_role(self.instance, 'outlaw')
     self.tweaker_user = make_tweaker_user(self.instance)
     self.conjurer_user = make_conjurer_user(self.instance)
コード例 #6
0
ファイル: test_audit.py プロジェクト: ctaylo37/OTM2
    def setUp(self):
        self.p1 = Point(-8515941.0, 4953519.0)
        self.instance = make_instance(point=self.p1)
        self.commander = make_commander_user(self.instance)
        self.officer = make_officer_user(self.instance)
        self.observer = make_observer_user(self.instance)
        self.outlaw = make_user_with_default_role(self.instance, 'outlaw')

        self.plot = Plot(geom=self.p1, instance=self.instance)
        self.plot.save_with_user(self.officer)

        self.tree = Tree(plot=self.plot, instance=self.instance)
        self.tree.save_with_user(self.officer)
コード例 #7
0
ファイル: test_audit.py プロジェクト: gapb/OTM2
    def setUp(self):
        self.p1 = Point(-8515941.0, 4953519.0)
        self.instance = make_instance(point=self.p1)
        self.commander = make_commander_user(self.instance)
        self.officer = make_officer_user(self.instance)
        self.observer = make_observer_user(self.instance)
        self.outlaw = make_user_with_default_role(self.instance, 'outlaw')

        self.plot = Plot(geom=self.p1, instance=self.instance)
        self.plot.save_with_user(self.officer)

        self.tree = Tree(plot=self.plot, instance=self.instance)
        self.tree.save_with_user(self.officer)
コード例 #8
0
ファイル: test_audit.py プロジェクト: OpenTreeMap/otm-core
    def setUp(self):
        self.p1 = Point(-7615441.0, 5953519.0)
        self.instance = make_instance(point=self.p1)

        self.commander = make_commander_user(self.instance)
        self.privileged_user = make_officer_user(self.instance)
        self.unprivileged_user = make_apprentice_user(self.instance)

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

        self.plot.save_with_user(self.commander)

        rm = ReputationMetric(instance=self.instance, model_name='Tree',
                              action=Audit.Type.Insert, direct_write_score=2,
                              approval_score=20, denial_score=5)
        rm.save()
コード例 #9
0
    def setUp(self):
        self.p1 = Point(-7615441.0, 5953519.0)
        self.instance = make_instance(point=self.p1)

        self.commander = make_commander_user(self.instance)
        self.privileged_user = make_officer_user(self.instance)
        self.unprivileged_user = make_apprentice_user(self.instance)

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

        self.plot.save_with_user(self.commander)

        rm = ReputationMetric(instance=self.instance, model_name='Tree',
                              action=Audit.Type.Insert, direct_write_score=2,
                              approval_score=20, denial_score=5)
        rm.save()
コード例 #10
0
ファイル: test_audit.py プロジェクト: OpenTreeMap/otm-core
    def setUp(self):
        instance = make_instance()
        # Fancy name, but no write, create, or delete permissions
        instance.default_role.name = Role.ADMINISTRATOR

        self.creator_user = make_officer_user(instance)
        self.admin_user = make_admin_user(instance)
        self.other_user = make_observer_user(instance, username='******')
        self.tweaker_user = make_tweaker_user(instance)
        self.conjurer_user = make_conjurer_user(instance)

        self.plot = Plot(geom=instance.center, instance=instance)
        self.plot.save_with_user(self.creator_user)

        self.tree = Tree(plot=self.plot, instance=instance)
        self.tree.save_with_user(self.creator_user)

        self.rainBarrel = RainBarrel(geom=instance.center, instance=instance,
                                     capacity=5)
        self.rainBarrel.save_with_user(self.creator_user)
コード例 #11
0
    def setUp(self):
        instance = make_instance()
        # Fancy name, but no write, create, or delete permissions
        instance.default_role.name = Role.ADMINISTRATOR

        self.creator_user = make_officer_user(instance)
        self.admin_user = make_admin_user(instance)
        self.other_user = make_observer_user(instance, username='******')
        self.tweaker_user = make_tweaker_user(instance)
        self.conjurer_user = make_conjurer_user(instance)

        self.plot = Plot(geom=instance.center, instance=instance)
        self.plot.save_with_user(self.creator_user)

        self.tree = Tree(plot=self.plot, instance=instance)
        self.tree.save_with_user(self.creator_user)

        self.rainBarrel = RainBarrel(geom=instance.center, instance=instance,
                                     capacity=5)
        self.rainBarrel.save_with_user(self.creator_user)
コード例 #12
0
    def test_mask_unauthorized_with_udfs(self):
        officer_user = make_officer_user(self.instance)

        self.plot.udfs['Test choice'] = 'b'
        self.plot.save_with_user(self.commander_user)
        self.plot.udfs['Test unauth'] = 'foo'
        self.plot.save_base()

        newplot = Plot.objects.get(pk=self.plot.pk)
        self.assertEqual(newplot.udfs['Test choice'], 'b')
        self.assertEqual(newplot.udfs['Test unauth'], 'foo')

        newplot = Plot.objects.get(pk=self.plot.pk)
        newplot.mask_unauthorized_fields(self.commander_user)
        self.assertEqual(newplot.udfs['Test choice'], 'b')
        self.assertEqual(newplot.udfs['Test unauth'], None)

        newplot = Plot.objects.get(pk=self.plot.pk)
        newplot.mask_unauthorized_fields(officer_user)
        self.assertEqual(newplot.udfs['Test choice'], None)
        self.assertEqual(newplot.udfs['Test unauth'], None)
コード例 #13
0
ファイル: udfs.py プロジェクト: danmcginnis/OTM2
    def test_mask_unauthorized_with_udfs(self):
        officer_user = make_officer_user(self.instance)

        self.plot.udfs['Test choice'] = 'b'
        self.plot.save_with_user(self.commander_user)
        self.plot.udfs['Test unauth'] = 'foo'
        self.plot.save_base()

        newplot = Plot.objects.get(pk=self.plot.pk)
        self.assertEqual(newplot.udfs['Test choice'], 'b')
        self.assertEqual(newplot.udfs['Test unauth'], 'foo')

        newplot = Plot.objects.get(pk=self.plot.pk)
        newplot.mask_unauthorized_fields(self.commander_user)
        self.assertEqual(newplot.udfs['Test choice'], 'b')
        self.assertEqual(newplot.udfs['Test unauth'], None)

        newplot = Plot.objects.get(pk=self.plot.pk)
        newplot.mask_unauthorized_fields(officer_user)
        self.assertEqual(newplot.udfs['Test choice'], None)
        self.assertEqual(newplot.udfs['Test unauth'], None)
コード例 #14
0
ファイル: test_udfs.py プロジェクト: OpenTreeMap/otm-core
    def test_mask_unauthorized_with_udfs(self):
        officer_user = make_officer_user(self.instance)

        self.plot.udfs["Test choice"] = "b"
        self.plot.save_with_user(self.commander_user)
        self.plot.udfs["Test unauth"] = "foo"
        self.plot.save_base()

        newplot = Plot.objects.get(pk=self.plot.pk)
        self.assertEqual(newplot.udfs["Test choice"], "b")
        self.assertEqual(newplot.udfs["Test unauth"], "foo")

        newplot = Plot.objects.get(pk=self.plot.pk)
        newplot.mask_unauthorized_fields(self.commander_user)
        self.assertEqual(newplot.udfs["Test choice"], "b")
        self.assertEqual(newplot.udfs["Test unauth"], None)

        newplot = Plot.objects.get(pk=self.plot.pk)
        newplot.mask_unauthorized_fields(officer_user)
        self.assertEqual(newplot.udfs["Test choice"], None)
        self.assertEqual(newplot.udfs["Test unauth"], None)