Esempio n. 1
0
 def test_add_photo_sets_updated(self):
     tree = Tree(diameter=10, plot=self.plot, instance=self.instance)
     tree.save_with_user(self.user)
     photo = TreePhoto(instance=self.instance,
                       map_feature=self.plot, tree=tree)
     photo.set_image(self.load_resource('tree1.gif'))
     photo.save_with_user(self.fellow)
     self.plot.refresh_from_db()
     self.assertGreater(self.plot.updated_at, self.initial_updated)
     self.assertEqual(self.plot.updated_by, self.fellow)
Esempio n. 2
0
 def test_add_photo_sets_updated(self):
     tree = Tree(diameter=10, plot=self.plot, instance=self.instance)
     tree.save_with_user(self.user)
     photo = TreePhoto(instance=self.instance,
                       map_feature=self.plot,
                       tree=tree)
     photo.set_image(self.load_resource('tree1.gif'))
     photo.save_with_user(self.fellow)
     self.plot.refresh_from_db()
     self.assertGreater(self.plot.updated_at, self.initial_updated)
     self.assertEqual(self.plot.updated_by, self.fellow)
Esempio n. 3
0
 def test_user_can_create_tree_photo(self):
     self._add_builtin_permission(self.role_yes, TreePhoto, 'add_treephoto')
     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)
     user_yes = make_user(instance=self.instance,
                          make_role=lambda inst: self.role_yes)
     photo = TreePhoto(instance=self.instance, map_feature=plot, tree=tree)
     photo.set_image(self.load_resource('tree1.gif'))
     self.assertTrue(photo.user_can_create(user_yes))
Esempio n. 4
0
 def test_user_can_create_tree_photo(self):
     self._add_builtin_permission(self.role_yes, TreePhoto, 'add_treephoto')
     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)
     user_yes = make_user(instance=self.instance,
                          make_role=lambda inst: self.role_yes)
     photo = TreePhoto(instance=self.instance,
                       map_feature=plot, tree=tree)
     photo.set_image(self.load_resource('tree1.gif'))
     self.assertTrue(photo.user_can_create(user_yes))