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: [ACI-1031] Upgrade requirements and resolve conflicts #182

Open
wants to merge 41 commits into
base: aci.upstream
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e036064
feat: removing the never-used Dockerfile-testing (#2503)
deborahgu Jun 17, 2024
fcc3859
fix(deps): update dependency sass to v1.77.6
renovate[bot] Jun 18, 2024
65d0c8f
chore: Upgrade Python requirements (#2506)
edx-requirements-bot Jun 18, 2024
2371522
fix(deps): update dependency webpack to v5.92.1
renovate[bot] Jun 20, 2024
0e7970d
fix(deps): update dependency @openedx/paragon to v22.6.1
renovate[bot] Jun 21, 2024
557a0e4
chore(deps): update dependency eslint-plugin-jsx-a11y to v6.9.0
renovate[bot] Jun 21, 2024
a7c129b
chore: Upgrade Python requirements (#2510)
edx-requirements-bot Jun 25, 2024
c5a0799
fix(deps): update dependency css-minimizer-webpack-plugin to v7 (#2472)
renovate[bot] Jun 25, 2024
588ab9a
fix(deps): update dependency css-loader to v7 (#2435)
renovate[bot] Jun 25, 2024
d9808ca
feat: removing visible_date attribute (#2511)
deborahgu Jul 1, 2024
3684059
chore: Upgrade Python requirements (#2512)
edx-requirements-bot Jul 2, 2024
24547a3
chore(deps): update dependency @edx/eslint-config to v4 (#2436)
renovate[bot] Jul 2, 2024
e604d61
chore: Upgrade Python requirements (#2514)
edx-requirements-bot Jul 9, 2024
96fbfea
fix(deps): update dependency sass to v1.77.7
renovate[bot] Jul 10, 2024
a7d509b
fix: replace deprecated github actions (#2513)
huniafatima-arbi Jul 10, 2024
66e6785
feat: the signatory is not mandatory on coursecertificate configurati…
deborahgu Jul 10, 2024
2abf618
chore(deps): update babel monorepo to v7.24.8
renovate[bot] Jul 12, 2024
7f99276
fix(deps): update dependency sass to v1.77.8
renovate[bot] Jul 12, 2024
d4170ee
fix(deps): update dependency webpack to v5.93.0
renovate[bot] Jul 12, 2024
75e4354
chore(deps): update dependency @babel/core to v7.24.9
renovate[bot] Jul 16, 2024
a0b4ef5
chore: Upgrade Python requirements (#2522)
edx-requirements-bot Jul 16, 2024
16e7399
feat: add badges feature
kyrylo-kh May 24, 2024
aa1c7d1
chore: update dummy translations
kyrylo-kh May 27, 2024
3a1ceb4
fix: merge conflicted migrations
kyrylo-kh May 27, 2024
73a0c31
test: fix penalties tests
kyrylo-kh May 27, 2024
833d68e
test: fix tests for credentials api
kyrylo-kh May 27, 2024
0218dfe
style: fix imports order
kyrylo-kh May 27, 2024
0ccc480
style: format code
kyrylo-kh May 27, 2024
8dda9ee
test: increase test coverage
May 30, 2024
e10140d
refactor: squash migrations + text cleanup + resolve conflict
Jun 11, 2024
4198426
refactor: clean up + requirement update
Jun 12, 2024
6218d0c
docs: documentation update
Jun 14, 2024
00feb2b
chore: requirements update
Jun 14, 2024
1ac3dba
docs: polishing
Jun 17, 2024
d30af2a
test: add tests for issuers, api_cliend and commands
kyrylo-kh Jul 2, 2024
9dd0992
refactor: code cleanup & docs rewording (#180)
andrii-hantkovskyi Jul 5, 2024
b9ed776
feat: [ACI-1031] Upgrade requirements
KyryloKireiev Jul 16, 2024
774079e
fix: [ACI-1031] Resolve migrations conflict
KyryloKireiev Jul 16, 2024
c4534d8
style: [ACI-1031] Try to fix linters
KyryloKireiev Jul 16, 2024
66c2b41
style: [ACI-1031] Try to fix linters v2
KyryloKireiev Jul 16, 2024
e7bc977
Merge branch 'aci.upstream' into aci.upstream.test
KyryloKireiev Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ omit =
*admin.py
*static*
*templates*
[report]
exclude_lines =
pragma: no cover
if TYPE_CHECKING:
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["py38"]
python-version: ["py311"]
django-version: ["django42"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.11"
architecture: x64
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.11"
architecture: x64
- name: Install Dependencies
run: make requirements
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/migrations-mysql8-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Get pip cache dir
id: pip-cache-dir
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip dependencies
id: cache-dependencies
uses: actions/cache@v4
Expand Down
27 changes: 0 additions & 27 deletions Dockerfile-testing

This file was deleted.

13 changes: 0 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,5 @@ pii_check: ## Check for PII annotations on all Django models
coverage:
coverage xml

### Local testing suite commands ###

build_test_image: # Builds Docker image used for testing so devs don't need to install requirements locally (useful for firefox / xvfb)
docker build -t credentials:local -f Dockerfile-testing .

# This should be ran locally, not inside of the devstack container
quality_and_translations_tests_suite: build_test_image
docker run -e "TERM=xterm-256color" -v /edx/app/credentials/node_modules/ -v `pwd`:/edx/app/credentials/ credentials:local bash -c 'cd /edx/app/credentials/ && make check_translations_up_to_date && make validate_translations && make quality && make check_keywords && make pii_check'

# This should be ran locally, not inside of the devstack container
unit_tests_suite: build_test_image
docker run -e "TERM=xterm-256color" -v /edx/app/credentials/node_modules/ -v `pwd`:/edx/app/credentials/ credentials:local bash -c 'cd /edx/app/credentials/ && make static && make tests && make coverage'

docs:
tox -e docs
39 changes: 1 addition & 38 deletions credentials/apps/api/v2/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_authentication(self):

def test_create(self):
program = ProgramFactory(site=self.site)
program_certificate = ProgramCertificateFactory(site=self.site, program_uuid=program.uuid)
program_certificate = ProgramCertificateFactory(site=self.site, program_uuid=program.uuid, program=program)
expected_username = self.user.username
expected_attribute_name = "fake-name"
expected_attribute_value = "fake-value"
Expand Down Expand Up @@ -356,43 +356,6 @@ def test_list_type_filtering(self):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data["results"], self.serialize_user_credential([program_cred], many=True))

# This test should be removed in MICROBA-1198 in favor of the next test.
def test_list_visible_filtering(self):
"""Verify the endpoint can filter by visible date."""
program_certificate = ProgramCertificateFactory(site=self.site)
course_run = CourseRunFactory()
course_certificate = CourseCertificateFactory(course_id=course_run.key, course_run=course_run, site=self.site)

course_cred = UserCredentialFactory(credential=course_certificate)
program_cred = UserCredentialFactory(credential=program_certificate)

UserCredentialAttributeFactory(
user_credential=program_cred,
name="visible_date",
value="9999-01-01T01:01:01Z",
)

self.authenticate_user(self.user)
self.add_user_permission(self.user, "view_usercredential")

both = [course_cred, program_cred]

response = self.client.get(self.list_path)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data["results"], self.serialize_user_credential(both, many=True))

response = self.client.get(self.list_path + "?only_visible=True")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data["results"], self.serialize_user_credential([course_cred], many=True))

response = self.client.get(self.list_path + "?only_visible=False")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data["results"], self.serialize_user_credential(both, many=True))

# The following test is the same as the previous test, but with the
# USE_CERTIFICATE_AVAILABLE_DATE waffle switch enabled. Clean up previous
# tests in MICROBA-1198.
@override_switch("credentials.use_certificate_available_date", active=True)
def test_list_visible_filtering_with_certificate_available_date(self):
"""Verify the endpoint can filter by visible date."""
course = CourseFactory.create(site=self.site)
Expand Down
3 changes: 2 additions & 1 deletion credentials/apps/badges/processing/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def process_event(sender, **kwargs):

except BadgesProcessingError as error:
logger.error(f"Badges processing error: {error}")
return
return None
return None


def identify_user(*, event_type, event_payload):
Expand Down
2 changes: 1 addition & 1 deletion credentials/apps/badges/tests/test_issuers.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_revoke_credly_badge_success(self, mock_revoke_badge):
self.assertEqual(user_credential.state, "revoked")

@patch.object(CredlyAPIClient, "revoke_badge", side_effect=CredlyAPIError("Revocation failed"))
def test_revoke_credly_badge_failure(self, mock_revoke_badge):
def test_revoke_credly_badge_failure(self, mock_revoke_badge): # pylint: disable=unused-argument
user_credential = self.issued_user_credential_type.objects.create(
username="test_user",
credential_content_type=ContentType.objects.get_for_model(self.badge_template),
Expand Down
12 changes: 6 additions & 6 deletions credentials/apps/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def activate_selected(self: admin.ModelAdmin, request, queryset):
message = _("1 {model_name} entry was successfully activated.")
else:
message = _("{count} {model_name} entries were successfully activated.")
message = message.format(count=count, model_name=model_name) # pylint: disable=no-member
message = message.format(count=count, model_name=model_name)
self.message_user(request, message)

@admin.action(description=_("Deactivate selected entries"))
Expand All @@ -42,7 +42,7 @@ def deactivate_selected(self: admin.ModelAdmin, request, queryset):
message = _("1 {model_name} entry was successfully deactivated.")
else:
message = _("{count} {model_name} entries were successfully deactivated.")
message = message.format(count=count, model_name=model_name) # pylint: disable=no-member
message = message.format(count=count, model_name=model_name)
self.message_user(request, message)

@admin.action(description=_("Add is_staff to selected entries"))
Expand All @@ -56,7 +56,7 @@ def add_is_staff_to_selected(self: admin.ModelAdmin, request, queryset):
message = _("1 {model_name} entry was successfully changed.")
else:
message = _("{count} {model_name} entries were successfully changed.")
message = message.format(count=count, model_name=model_name) # pylint: disable=no-member
message = message.format(count=count, model_name=model_name)
self.message_user(request, message)

@admin.action(description=_("Remove is_staff from selected entries"))
Expand All @@ -70,7 +70,7 @@ def remove_is_staff_from_selected(self: admin.ModelAdmin, request, queryset):
message = _("1 {model_name} entry was successfully changed.")
else:
message = _("{count} {model_name} entries were successfully changed.")
message = message.format(count=count, model_name=model_name) # pylint: disable=no-member
message = message.format(count=count, model_name=model_name)
self.message_user(request, message)

@admin.action(description=_("Add is_superuser to selected entries"))
Expand All @@ -84,7 +84,7 @@ def add_is_superuser_to_selected(self: admin.ModelAdmin, request, queryset):
message = _("1 {model_name} entry was successfully changed.")
else:
message = _("{count} {model_name} entries were successfully changed.")
message = message.format(count=count, model_name=model_name) # pylint: disable=no-member
message = message.format(count=count, model_name=model_name)
self.message_user(request, message)

@admin.action(description=_("Remove is_superuser from selected entries"))
Expand All @@ -103,7 +103,7 @@ def remove_is_superuser_from_selected(self: admin.ModelAdmin, request, queryset)
message = _("1 {model_name} entry was successfully changed.")
else:
message = _("{count} {model_name} entries were successfully changed.")
message = message.format(count=count, model_name=model_name) # pylint: disable=no-member
message = message.format(count=count, model_name=model_name)
self.message_user(request, message)
self.message_user(request, WARNING, level=messages.WARNING)

Expand Down
5 changes: 1 addition & 4 deletions credentials/apps/credentials/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@


if TYPE_CHECKING:
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site

from credentials.apps.catalog.models import CourseRun

User = get_user_model()


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -235,7 +232,7 @@ def get_credential_dates(user_credentials, many):
return get_credential_visible_date(user_credentials, use_date_override=True)


def process_course_credential_update(user: "User", course_run_key: str, mode: str, credential_status: str) -> None:
def process_course_credential_update(user, course_run_key: str, mode: str, credential_status: str) -> None:
"""
A utility function responsible for creating or updating a course credential associated with a learner. Primarily
used when consuming events from the Event Bus.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Migration(migrations.Migration):

dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("credentials", "0028_alter_historicalprogramcompletionemailconfiguration_options"),
("credentials", "0029_signatory_not_mandatory"),
]

operations = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.13 on 2024-07-09 16:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("credentials", "0028_alter_historicalprogramcompletionemailconfiguration_options"),
]

operations = [
migrations.AlterField(
model_name="coursecertificate",
name="signatories",
field=models.ManyToManyField(blank=True, to="credentials.signatory"),
),
]
5 changes: 5 additions & 0 deletions credentials/apps/credentials/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ class CourseCertificate(AbstractCertificate):
.. no_pii: This model has no PII.
"""

# Not all sites will require signatories in course certificate configurations, but signatories are required in
# program certificates configurations. This is cloned data from the system of record, as the course certificates
# don't render in the Credentials IDA.
signatories = models.ManyToManyField(Signatory, blank=True)

# course_id is identical to course_run.key. It is a deprecated legacy property. For now it is still used as a
# convenience accessor and filter but it will be eventually removed. If you need the value stored in course_id,
# get it from course_run.key.
Expand Down
Loading