Skip to content

Feat/test identity models#18

Merged
AAdewunmi merged 8 commits into
mainfrom
feat/test-identity-models
May 5, 2026
Merged

Feat/test identity models#18
AAdewunmi merged 8 commits into
mainfrom
feat/test-identity-models

Conversation

@AAdewunmi

Copy link
Copy Markdown
Owner

Summary

Adds test support and coverage for StudyBuddy identity models.

Changes

  • Added factories for custom users and roles.
  • Added common role traits for student, tutor, and admin.
  • Added user factory support for role assignments.
  • Added model tests for email-first user behavior.
  • Added model tests for role display names, unique slugs, and common role traits.
  • Updated factories to use the project’s real role relationship, user.studybuddy_roles.
  • Used factory.django.Password for realistic hashed user passwords.

Behavior

Tests can now create realistic users and roles from the start, including common role assignments used for future access-control behavior.

Why

Identity and permission behavior will sit underneath dashboard and feature access. These factories and tests make that baseline easier to verify without scattering setup details or hard-coded role data through future tests.

Validation

  • docker compose exec web python -m black . --check
  • docker compose exec web python -m ruff check .
  • docker compose exec web pytest apps/users/tests/test_models.py apps/roles/tests/test_models.py -q
  • docker compose exec web pytest -q

Result

All validation passes. The full test suite reports 25 passed.

Notes

The common role traits are intentionally lightweight. They provide stable test setup until formal permission rules are introduced.

@codecov

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.82353% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/users/factories.py 95.45% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@AAdewunmi AAdewunmi merged commit 23e5094 into main May 5, 2026
2 checks passed
@AAdewunmi AAdewunmi deleted the feat/test-identity-models branch May 5, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sprint-1-testing-users-roles Test identity models

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

Test identity models

1 participant