Skip to content

Add integration tests for oauth #723

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

Open
wants to merge 6 commits into
base: 2/main
Choose a base branch
from

Conversation

Thanhphan1147
Copy link
Collaborator

@Thanhphan1147 Thanhphan1147 commented Mar 16, 2025

Add integration test for oauth integration:

  1. deploy and configure the external-idp-integrator charm and configure it with mock values
  2. check that MAS config has the configured idp values.

Checklist

  • The charm style guide was applied
  • The contributing guide was applied
  • The changes are compliant with ISD054 - Manging Charm Complexity
  • The documentation is generated using src-docs
  • The documentation for charmhub is updated.
  • The PR is tagged with appropriate label (urgent, trivial, complex)
  • The changelog is updated with changes that affect the users of the charm.

act: send a request to the Synapse application managed by the Synapse charm.
assert: the Synapse application should return a correct response.
"""
await synapse_app.model.relate(synapse_app.name, oauth_external_idp_integrator.name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative we could integrate using a pytest fixture (and remove the integration after the yield), so the local option --use-existing can be used with this test.

Copy link
Contributor

Test results for commit e0a0f30

Test coverage for e0a0f30

Name                                    Stmts   Miss Branch BrPart  Cover   Missing
-----------------------------------------------------------------------------------
src/auth/__init__.py                        0      0      0      0   100%
src/auth/mas.py                            87      6      2      0    93%   94-96, 113-115
src/backup.py                             175      5     20      2    96%   351-352, 421-422, 479->481, 482
src/backup_observer.py                    134     16     12      0    89%   132-135, 140-143, 179-182, 211-214
src/charm.py                              288     24     66     11    90%   151->153, 156, 230, 288, 292-293, 299-300, 321-322, 346, 353, 428-432, 435-436, 464-466, 486, 583-589
src/charm_types.py                         30      0      0      0   100%
src/database_client.py                     57      1      8      4    92%   35, 47->exit, 69->exit, 88->98
src/database_observer.py                   49      4      2      0    92%   61-64
src/exceptions.py                           3      0      0      0   100%
src/matrix_auth_observer.py                59      5      6      0    92%   133-137
src/media_observer.py                      45      4      2      1    89%   60-62, 81
src/observability.py                       13      0      0      0   100%
src/pebble.py                             194     23     44     11    86%   157->exit, 168-172, 216-217, 237-238, 256-259, 320->325, 330-331, 343-344, 346-347, 378, 380, 382, 384, 386, 418
src/redis_observer.py                      39      3      4      0    93%   63-66
src/s3_parameters.py                       22      0      4      0   100%
src/smtp_observer.py                       61      1     14      2    96%   89, 108->113
src/state/__init__.py                       0      0      0      0   100%
src/state/charm_state.py                  127      9     32      7    90%   162, 166, 187, 212, 218, 224, 228-229, 312
src/state/mas.py                           79      8      6      3    87%   154, 160-161, 187-189, 204, 224
src/state/validation.py                    36      3      2      0    92%   110-112
src/synapse/__init__.py                     3      0      0      0   100%
src/synapse/api.py                        129      6     18      4    93%   111-112, 161, 172, 174, 314
src/synapse/workload.py                   118      4     24      0    94%   365-368
src/synapse/workload_configuration.py     149     26     34     12    79%   90->exit, 94-95, 143-144, 173, 193-194, 226-227, 260, 269-270, 285, 290-291, 312-313, 332->337, 338, 356->358, 368-369, 397, 405->407, 407->409, 414-415, 435->442, 445, 465-466
src/user.py                                23      0      2      0   100%
-----------------------------------------------------------------------------------
TOTAL                                    1920    148    302     57    91%

Static code analysis report

Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Run started:2025-03-19 14:20:02.141777

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 9857
  Total lines skipped (#nosec): 4
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants