Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that casting tenancy_db_password to encrypted works as expected #1284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukinovec
Copy link
Contributor

@lukinovec lukinovec commented Jan 3, 2025

Add a test that ensures that casting tenancy_db_password to encrypted works correctly ('tenancy_db_password' => 'encrypted' in the Tenant model's casts() method's returned array).

NOTE: using PermissionControlledMySQLDatabaseManager

Meaning:

  • when creating a tenant, tenancy_db_password gets automatically encrypted (the encrypted password is saved in the DB)
  • accessing the password like $tenant->tenancy_db_password returns the decrypted password
  • the decrypted password is used for connecting to the tenant database, and the connection is successful (+ DB operations work as expected)

This works when both using a specific tenancy_db_password during tenant creation, and when not specifying any tenancy_db_password (in the latter case, the DB manager generates a random password for tenancy_db_password, which still gets encrypted).

Copy link

codecov bot commented Jan 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.74%. Comparing base (6b38a35) to head (1af195f).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1284   +/-   ##
=========================================
  Coverage     84.74%   84.74%           
  Complexity     1025     1025           
=========================================
  Files           174      174           
  Lines          3015     3015           
=========================================
  Hits           2555     2555           
  Misses          460      460           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant