openml / server-api

Python-based server
https://openml.github.io/server-api/
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Maint/test #205

Closed PGijsbers closed 4 days ago

PGijsbers commented 4 days ago

Add more tests for authentication

Summary by Sourcery

Enhance test coverage for dataset access by adding parameterized tests for different user roles and standardizing the use of 'SOME_USER' in place of 'REGULAR_USER' across test cases.

Tests:

sourcery-ai[bot] commented 4 days ago

Reviewer's Guide by Sourcery

This pull request enhances the test suite for authentication in the OpenML project. It focuses on improving and expanding tests for private dataset access, user roles, and API key handling. The changes primarily affect test files related to datasets, users, and authentication.

Class diagram for ApiKey changes

classDiagram
    class ApiKey {
        +str ADMIN
        +str SOME_USER
        +str OWNER_USER
        +str INVALID
    }
    note for ApiKey "Updated REGULAR_USER to SOME_USER"

File-Level Changes

Change Details Files
Refactored and expanded tests for private dataset access
  • Updated test parameters to use predefined API keys
  • Removed skipped tests and implemented proper authentication checks
  • Combined separate owner and admin access tests into a single parameterized test
  • Added comparison between new and old API responses
tests/routers/openml/migration/datasets_migration_test.py
tests/routers/openml/datasets_test.py
Standardized API key naming conventions
  • Renamed 'REGULAR_USER' to 'SOME_USER' for consistency
  • Updated all references to API keys across test files
tests/routers/openml/datasets_list_datasets_test.py
tests/routers/openml/dataset_tag_test.py
tests/routers/openml/users_test.py
tests/users.py
Improved test coverage for different user roles
  • Added parameterized tests to check access for different user types (admin, owner, regular user)
  • Updated test cases to account for private dataset visibility based on user role
tests/routers/openml/datasets_test.py
tests/routers/openml/datasets_list_datasets_test.py

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).