Skip to content

Check if user can create package in pypi create package service

  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

What does this MR do and why?

  • This addition was motivated while working on another MR and noticing that:
    1. The user variable (used for testing) was not a member of the given project => this means that user variable did not reflect the real world as the Pypi::CreatePackageService usually receives a user that is project member
    2. there was no test case for an unauthorized user in the pypi package creation service test.
  • This MR intends to add this test case and the handling of unauthorized users in the service itself.

🛠 with at Siemens

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

MR Checklist (@gerardo-navarro)

Screenshots or screen recordings

NA. No UI changes.

How to set up and validate locally

  1. Run the test cases of the pypi create package service
bundle exec rspec spec/services/packages/pypi/create_package_service_spec.rb

Related to #323971

Edited by Radamanthus Batnag

Merge request reports

Loading