예제 #1
0
    def test_plot_is_not_deletable(self):
        user_no = make_user(instance=self.instance,
                            make_role=lambda inst: self.role_no)
        plot = Plot(instance=self.instance)

        self.assertFalse(
            perms.is_deletable(user_no.get_instance_user(self.instance), plot))
예제 #2
0
    def test_plot_is_not_deletable(self):
        user_no = make_user(instance=self.instance,
                            make_role=lambda inst: self.role_no)
        plot = Plot(instance=self.instance)

        self.assertFalse(
            perms.is_deletable(user_no.get_instance_user(self.instance),
                               plot))
예제 #3
0
    def test_plot_is_deletable(self):
        self._add_builtin_permission(self.role_yes, Plot, 'delete_plot')

        user_yes = make_user(instance=self.instance,
                             make_role=lambda inst: self.role_yes)
        plot = Plot(instance=self.instance)

        self.assertTrue(
            perms.is_deletable(user_yes.get_instance_user(self.instance),
                               plot))
예제 #4
0
    def test_plot_is_deletable(self):
        self._add_builtin_permission(self.role_yes, Plot, 'delete_plot')

        user_yes = make_user(instance=self.instance,
                             make_role=lambda inst: self.role_yes)
        plot = Plot(instance=self.instance)

        self.assertTrue(
            perms.is_deletable(user_yes.get_instance_user(self.instance),
                               plot))
예제 #5
0
    def test_rainbarrel_photo_is_deletable(self):
        rainbarrel = self._create_rainbarrel_return_map_feature()
        image = self.load_resource('tree1.gif')

        photo = rainbarrel.add_photo(image, self.commander)

        self._add_builtin_permission(self.role_yes, MapFeaturePhoto,
                                     'delete_rainbarrelphoto')
        user_yes = make_user(instance=self.instance,
                             make_role=lambda inst: self.role_yes)
        self.assertTrue(
            perms.is_deletable(user_yes.get_instance_user(self.instance),
                               photo))
예제 #6
0
    def test_rainbarrel_photo_is_deletable(self):
        rainbarrel = self._create_rainbarrel_return_map_feature()
        image = self.load_resource('tree1.gif')

        photo = rainbarrel.add_photo(image, self.commander)

        self._add_builtin_permission(self.role_yes, MapFeaturePhoto,
                                     'delete_rainbarrelphoto')
        user_yes = make_user(instance=self.instance,
                             make_role=lambda inst: self.role_yes)
        self.assertTrue(
            perms.is_deletable(user_yes.get_instance_user(self.instance),
                               photo))
예제 #7
0
    def test_tree_photo_is_not_deletable(self):
        commander = make_commander_user(self.instance)
        plot = Plot(instance=self.instance, geom=self.p)
        plot.save_with_user(commander)
        tree = Tree(plot=plot, instance=self.instance)
        tree.save_with_user(commander)
        image = self.load_resource('tree1.gif')

        photo = tree.add_photo(image, commander)

        user_no = make_user(instance=self.instance,
                            make_role=lambda inst: self.role_no)
        self.assertFalse(
            perms.is_deletable(user_no.get_instance_user(self.instance),
                               photo))
예제 #8
0
    def test_tree_photo_is_not_deletable(self):
        commander = make_commander_user(self.instance)
        plot = Plot(instance=self.instance, geom=self.p)
        plot.save_with_user(commander)
        tree = Tree(plot=plot, instance=self.instance)
        tree.save_with_user(commander)
        image = self.load_resource('tree1.gif')

        photo = tree.add_photo(image, commander)

        user_no = make_user(instance=self.instance,
                            make_role=lambda inst: self.role_no)
        self.assertFalse(
            perms.is_deletable(user_no.get_instance_user(self.instance),
                               photo))
예제 #9
0
    def test_rainbarrel_photo_is_not_deletable(self):
        rainbarrel = self._create_rainbarrel_return_map_feature()
        image = self.load_resource('tree1.gif')

        photo = rainbarrel.add_photo(image, self.commander)

        self._add_builtin_permission(self.role_no, RainBarrel,
                                     'delete_rainbarrel')
        self._add_builtin_permission(self.role_no, Bioswale, 'delete_bioswale')
        self._add_builtin_permission(self.role_no, MapFeaturePhoto,
                                     'delete_bioswalephoto')
        user_no = make_user(instance=self.instance,
                            make_role=lambda inst: self.role_no)
        self.assertFalse(
            perms.is_deletable(user_no.get_instance_user(self.instance),
                               photo))
예제 #10
0
    def test_tree_photo_is_deletable(self):
        commander = make_commander_user(self.instance)
        plot = Plot(instance=self.instance, geom=self.p)
        plot.save_with_user(commander)
        tree = Tree(plot=plot, instance=self.instance)
        tree.save_with_user(commander)
        image = self.load_resource('tree1.gif')

        photo = tree.add_photo(image, commander)

        self._add_builtin_permission(self.role_yes, TreePhoto,
                                     'delete_treephoto')
        user_yes = make_user(instance=self.instance,
                             make_role=lambda inst: self.role_yes)
        self.assertTrue(
            perms.is_deletable(user_yes.get_instance_user(self.instance),
                               photo))
예제 #11
0
    def test_rainbarrel_photo_is_not_deletable(self):
        rainbarrel = self._create_rainbarrel_return_map_feature()
        image = self.load_resource('tree1.gif')

        photo = rainbarrel.add_photo(image, self.commander)

        self._add_builtin_permission(self.role_no, RainBarrel,
                                     'delete_rainbarrel')
        self._add_builtin_permission(self.role_no, Bioswale,
                                     'delete_bioswale')
        self._add_builtin_permission(self.role_no, MapFeaturePhoto,
                                     'delete_bioswalephoto')
        user_no = make_user(instance=self.instance,
                            make_role=lambda inst: self.role_no)
        self.assertFalse(
            perms.is_deletable(user_no.get_instance_user(self.instance),
                               photo))
예제 #12
0
    def test_tree_photo_is_deletable(self):
        commander = make_commander_user(self.instance)
        plot = Plot(instance=self.instance, geom=self.p)
        plot.save_with_user(commander)
        tree = Tree(plot=plot, instance=self.instance)
        tree.save_with_user(commander)
        image = self.load_resource('tree1.gif')

        photo = tree.add_photo(image, commander)

        self._add_builtin_permission(self.role_yes, TreePhoto,
                                     'delete_treephoto')
        user_yes = make_user(instance=self.instance,
                             make_role=lambda inst: self.role_yes)
        self.assertTrue(
            perms.is_deletable(user_yes.get_instance_user(self.instance),
                               photo))