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

feat: add integration tests for the enrollments api AP-1346 #280

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

BryanttV
Copy link
Contributor

@BryanttV BryanttV commented Sep 19, 2024

Description

This PR adds integration tests for the enrollment API. These tests are executed in the job of Tutor Integration Tests

This PR is part of a set of PRs to add integration tests to the enrollment API. It must be separated into different PRs because doing it in one PR exceeds the maximum size allowed by the pr-size-labeler action.

Testing instructions

Check the jobs of Tutor Integration Tests in the PR.

Jira Issue

@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch from 517d530 to 0e54e60 Compare September 23, 2024 20:36
@BryanttV BryanttV changed the title feat: add integration tests for the enrollments api feat: add integration tests for the enrollments api AP-1346 Sep 23, 2024
@BryanttV BryanttV marked this pull request as ready for review September 23, 2024 20:45
@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch from 7bf9213 to 0b9bcb8 Compare September 24, 2024 15:12
@BryanttV BryanttV changed the base branch from master to bav/add-fixtures-users-for-integration-tests September 24, 2024 15:14
@BryanttV BryanttV force-pushed the bav/add-fixtures-users-for-integration-tests branch from dbd0ecf to c6af9f6 Compare September 24, 2024 15:19
@BryanttV BryanttV requested a review from a team September 24, 2024 16:38
@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch from af33974 to 5af2d39 Compare September 24, 2024 16:40
@BryanttV BryanttV changed the base branch from bav/add-fixtures-users-for-integration-tests to master September 25, 2024 17:37
@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch from 5af2d39 to e80e6a3 Compare September 25, 2024 17:43
@github-actions github-actions bot added size/l and removed size/xl labels Sep 25, 2024
@BryanttV BryanttV requested review from a team and removed request for a team September 25, 2024 22:14
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
Copy link
Member

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

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

I'll leave this so you can commit them in bulk.

eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
eox_core/api/v1/tests/integration/test_views.py Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
scripts/execute_integration_tests.sh Outdated Show resolved Hide resolved
.github/workflows/integration-test.yml Outdated Show resolved Hide resolved
@@ -7,7 +7,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
tutor_version: ['<18.0.0', '<19.0.0']
include:
Copy link
Contributor

Choose a reason for hiding this comment

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

@BryanttV can we please explain why is this implementation necessary in the PR description? I think it's important to explain the reasoning behind this decision


Since I’m considering moving tutor local do importdemocourse to the GitHub Action, should we also pass the course ID to the environment in the step that runs the integration tests? This way, the action would handle the full demo course setup, and we can ensure that the tests always reference the correct course and prevent each plugin from setting it manually

I was able to obtain the course ID dynamically with:

COURSE_KEY=$(tutor local exec lms python manage.py lms shell -c "from openedx.core.djangoapps.content.course_overviews.models import CourseOverview; course = CourseOverview.objects.first(); print(course.id, end='')")

However, if the import process changes in future Open edX versions, this could break the tests. Of course, we could always introduce version-based logic to handle that, but we could also just set the course ID manually in the action (assuming the Demo course ID won’t change frequently). Starting from Tutor version 18.0.0, the ID is course-v1:OpenedX+DemoX+DemoCourse, so we’d handle logic for both IDs for now, and remove support for versions below 18.0.0 later

I’d like to hear your thoughts on this approach @BryanttV @mariajgrimaldi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I really like what you propose. I think it's more appropriate to leave that responsibility to the action, than to keep it in every plugin.

Copy link
Member

@mariajgrimaldi mariajgrimaldi Sep 27, 2024

Choose a reason for hiding this comment

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

We should definitely move this to the GH action itself.

I like the proposal's automatic approach to getting the course ID. However, I'm very wary of using code from the platform without any API or interface, even from the shell. I don't think it's worth it, considering the course ID hasn't changed much over time. The last change was very much needed: openedx/openedx-demo-course#50, it looks like it was very axim-specific for some reason.

@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch 2 times, most recently from 9aa144a to 6f68900 Compare September 26, 2024 18:22
@github-actions github-actions bot added size/l and removed size/xl labels Sep 26, 2024
mariajgrimaldi
mariajgrimaldi previously approved these changes Sep 27, 2024
Copy link
Member

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

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

I'll leave my approval again once we address the last couple of comments. Thank you!

@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch 3 times, most recently from abefbb2 to b29faf0 Compare September 27, 2024 18:41
@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch from b29faf0 to 6ba8bb0 Compare September 27, 2024 18:43
@github-actions github-actions bot added size/l and removed size/xl labels Sep 27, 2024
@github-actions github-actions bot added size/xl and removed size/l labels Sep 27, 2024
@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch from 182be1f to cb6ce0b Compare September 27, 2024 19:56
@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch from 964d1c5 to 8cb8b3d Compare September 27, 2024 20:17
@github-actions github-actions bot added size/l and removed size/xl labels Sep 27, 2024
@BryanttV BryanttV force-pushed the bav/add-integration-tests-to-enrollment-api branch from 8cb8b3d to c5607d3 Compare September 27, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants