Skip to content

test(render): add unit tests for FinetuneHandlerImpl - #1541

Open
sabhi128 wants to merge 2 commits into
OpenCSGs:mainfrom
sabhi128:feat-finetune-handler-tests
Open

test(render): add unit tests for FinetuneHandlerImpl#1541
sabhi128 wants to merge 2 commits into
OpenCSGs:mainfrom
sabhi128:feat-finetune-handler-tests

Conversation

@sabhi128

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR expands backend test coverage by adding unit tests for FinetuneHandlerImpl under internal/handlers/render/.

Changes:

  • New File: internal/handlers/render/finetune_test.go
    • Added route rendering coverage for:
      1. List route (finetunes_index template rendering).
      2. Detail route (parameter mapping of namespace, model_name, finetune_id, and finetune_name to finetunes_show template).
      3. New route (checks context layout and license dictionary injection matching DefaultLicensesJSON).

All rendering calls are tested in isolation using Mockery's testifying mocks.

Copilot AI lite review requested due to automatic review settings August 29, 2026 09:23

Copilot AI 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.

Pull request overview

This PR adds unit-test coverage for the render-layer FinetuneHandlerImpl routes under internal/handlers/render/, validating that the correct templates are rendered with the expected data bindings for finetunes pages.

Changes:

  • Added a new finetune_test.go test file covering List, Detail, and New routes for finetunes.
  • Verified template selection (finetunes_index, finetunes_show, finetunes_new) and key route-param → template-data mappings, including licenses injection.
Suppressed comments (3)

internal/handlers/render/finetune_test.go:36

  • This test currently only relies on the mock expectation. Add an explicit status assertion (as done in internal/handlers/render/models_test.go) so the test also fails if the handler starts writing a non-200 response.
	handler.List(ctx)
}

internal/handlers/render/finetune_test.go:75

  • Add an explicit HTTP status assertion after calling Detail(), matching the pattern used by other handler render tests (e.g., models_test.go) to catch unintended status changes.
	handler.Detail(ctx)
}

internal/handlers/render/finetune_test.go:102

  • Add an explicit HTTP status assertion after calling New(), matching the pattern used by other handler render tests to ensure the handler doesn’t accidentally return a non-200 status.
	handler.New(ctx)
}

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/handlers/render/finetune_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants