Skip to content

test(events): align listing tests with private-event exclusion (#12071) - #12218

Open
ionfwsrijan wants to merge 1 commit into
SandeepVashishtha:masterfrom
ionfwsrijan:fix/issue-12071
Open

test(events): align listing tests with private-event exclusion (#12071)#12218
ionfwsrijan wants to merge 1 commit into
SandeepVashishtha:masterfrom
ionfwsrijan:fix/issue-12071

Conversation

@ionfwsrijan

Copy link
Copy Markdown
Contributor

Problem

Issue #12071: private events (isPublic = false) are supposed to be invisible through the public event endpoints. EventService.getPublicEventById/getAllEvents already filter them out, but two controller tests still asserted the pre-fix behavior and would fail CI:

  • GetEventByIdTests.testGetPrivateEventById expected 200 and the private event body;
  • ListEventsTests.testGetAllEvents expected the private event to be included in GET /api/events.

Fix

Align the tests with the documented behavior and add explicit regression coverage:

  • testGetPrivateEventById now expects 404 with the standard "Event not found" message.
  • testGetAllEvents now expects only the public event.
  • New testGetAllEventsExcludesPrivateEvents asserts the private event is absent from the listing.

Files changed

  • Backend/src/test/java/com/sandeep/eventrabackend/controller/GetEventByIdTests.java
  • Backend/src/test/java/com/sandeep/eventrabackend/controller/ListEventsTests.java

Testing

  • Not run locally (Maven wrapper is broken in this checkout); matches the assertions already produced by EventService's isPublic/CANCELLED filtering and the existing 404 error body contract.

Closes #12071

…SandeepVashishtha#12071)

The public read path already excludes isPublic=false events
(EventService filters Event::isPublic), but two controller tests still
asserted the pre-fix behavior and would fail CI:

- ListEventsTests.testGetAllEvents expected 2 events including a private
  one; it now expects only the public event and adds an explicit
  assertion that the private event is absent.
- GetEventByIdTests.testGetPrivateEventById expected 200 + the private
  event body; it now expects 404, matching the documented behavior that
  private events are only visible to their organizer or an admin.
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@ionfwsrijan is attempting to deploy a commit to the sandeepvashishtha's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No quality gates enabled for this code.

See analysis details in CodeScene

Quality Gate Profile: Custom Configuration
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@ionfwsrijan

Copy link
Copy Markdown
Contributor Author

@SandeepVashishtha Please review this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Private events exposed publicly

1 participant