def test_delete_as_admin_success(self): user = factory.make_admin() handler = ZoneHandler(user, {}, None) zone = factory.make_Zone() handler.delete({"id": zone.id}) zone = reload_object(zone) self.assertThat(zone, Equals(None))
def test__delete_default_zone_fails(self): zone = Zone.objects.get_default_zone() user = factory.make_admin() handler = ZoneHandler(user, {}) with ExpectedException(ValidationError): handler.delete({ "id": zone.id, })
def test__delete_as_non_admin_asserts(self): user = factory.make_User() handler = ZoneHandler(user, {}) zone = factory.make_Zone() with ExpectedException(AssertionError, "Permission denied."): handler.delete({ "id": zone.id, })