Ejemplo n.º 1
0
 def test_delete_as_admin_success(self):
     user = factory.make_admin()
     handler = SpaceHandler(user, {}, None)
     space = factory.make_Space()
     handler.delete({"id": space.id})
     space = reload_object(space)
     self.assertThat(space, Equals(None))
Ejemplo n.º 2
0
 def test_reloads_user(self):
     user = factory.make_admin()
     handler = SpaceHandler(user, {}, None)
     space = factory.make_Space()
     user.is_superuser = False
     user.save()
     with ExpectedException(AssertionError, "Permission denied."):
         handler.delete({"id": space.id})
Ejemplo n.º 3
0
 def test__delete_as_non_admin_asserts(self):
     user = factory.make_User()
     handler = SpaceHandler(user, {}, None)
     space = factory.make_Space()
     with ExpectedException(AssertionError, "Permission denied."):
         handler.delete({
             "id": space.id,
         })