Skip to content

Comments

Test changes and clean up#31

Merged
LucasZimm merged 3 commits into29-testcasesfrom
29-testcases-jmp
Feb 16, 2026
Merged

Test changes and clean up#31
LucasZimm merged 3 commits into29-testcasesfrom
29-testcases-jmp

Conversation

@JosePizarro3
Copy link
Member

@LucasZimm check this out. I worked on top of your branch #30 . Once you check these, we can merge into your branch, and this into the cookiecutter install.

Here is a summary:

  1. Expanded test_views.py to cover login, logout_view, homepage, and clear_state positive/negative paths, with full mocking of OpenBIS and side effects.
  2. Centralized shared test fixtures in conftest.py, including Django setup, request session helpers, and file upload helpers.
  3. Made the entry point loader test deterministic by mocking importlib.metadata.entry_points instead of depending on an installed external parser.
  4. Removed the placeholder test_dummy.py.
  5. Restructured pyproject.toml:
    • Moved [project] metadata to the top.
    • Removed DJANGO_SETTINGS_MODULE from pytest config (moved Django setup to conftest.py instead).
    • Merged dev dependencies into [project.optional-dependencies].dev and removed the duplicated [dependency-groups].dev list. I also cleaned the ruff rules, because some of them are extremely annoying (I mean, maximum 5 inputs for a function, wtf???).

I pretty much used CODEX to expand the test_views.py, with some tweeks here and there. Now, I did all of this because:

  • The original view tests were good for you to learn how to Mock stuff, but they only exercised a narrow subset of login and skipped session/cache/redirect behavior, leaving most of views.py uncovered. I tried to extend this so you see what "doing tests" means (not because what you did was wrong or incomplete; I just sent you a smaller subset on purpose).
  • The tests relied on implicit Django settings and URL resolution, which caused failures in isolation; a session-scoped Django setup fixture fixes this consistently. If I am not mistaken, this is an issue of the cookiecutter.
  • The entry point test should not require an external package to be installed. Mocking makes it stable and CI-safe.
  • test_dummy.py was redundant after real tests were added.
  • pyproject.toml cleanup avoids conflicting dev dependency definitions and aligns with your preference for [project] metadata at the top.

Added a mock instead of the real entry point for tests/entry_points/test_load.py

Deleted test_dummy.py

Added more tests in test_views.py

Moved mocks to conftest.py

Added positive and negative situations in test_views.py
@JosePizarro3 JosePizarro3 changed the base branch from main to 29-testcases February 13, 2026 07:28
@LucasZimm LucasZimm merged commit 0e0e092 into 29-testcases Feb 16, 2026
2 checks passed
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