From c8a1904b66786269674939fffab0f143e46db1f3 Mon Sep 17 00:00:00 2001 From: Ali Akbar Date: Wed, 11 Sep 2024 22:46:45 +0500 Subject: [PATCH] build: update actions/upload-artifact to v4 --- .github/workflows/ci.yml | 2 +- .../tests/test_update_course_ai_translations.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7483eac258..516c3ced60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: continue-on-error: ${{ matrix.status == 'ignored' }} - name: Upload coverage if: matrix.db-version == 'mysql80' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: coverage${{ matrix.pytest-split-group }} path: .coverage diff --git a/course_discovery/apps/course_metadata/management/commands/tests/test_update_course_ai_translations.py b/course_discovery/apps/course_metadata/management/commands/tests/test_update_course_ai_translations.py index 25511bf141..9313e97774 100644 --- a/course_discovery/apps/course_metadata/management/commands/tests/test_update_course_ai_translations.py +++ b/course_discovery/apps/course_metadata/management/commands/tests/test_update_course_ai_translations.py @@ -105,9 +105,11 @@ def test_command_with_marketable_and_active_flag(self, mock_get_translations): """Test the command with the marketable and active flag filtering both marketable and active course runs.""" mock_get_translations.return_value = { **self.TRANSLATION_DATA, - 'available_translation_languages': [{'code': 'es', 'label': 'Spanish'}] + 'available_translation_languages': [{'code': 'fr', 'label': 'French'}] } + non_active_non_marketable_course_run = CourseRunFactory( + end=now() - datetime.timedelta(days=10), translation_languages=[]) active_non_marketable_course_run = CourseRunFactory(end=now() + datetime.timedelta(days=10)) verified_and_audit_type = CourseRunType.objects.get(slug='verified-audit') @@ -117,22 +119,24 @@ def test_command_with_marketable_and_active_flag(self, mock_get_translations): marketable_non_active_course_run = CourseRunFactory( status='published', slug='test-course-run', - type=verified_and_audit_type + type=verified_and_audit_type, + end=now() - datetime.timedelta(days=10), translation_languages=[] ) seat = SeatFactory(course_run=marketable_non_active_course_run) marketable_non_active_course_run.seats.add(seat) - call_command('update_course_ai_translations', partner=self.partner.name, marketable=True) + call_command('update_course_ai_translations', partner=self.partner.name, marketable=True, active=True) marketable_non_active_course_run.refresh_from_db() self.assertListEqual( marketable_non_active_course_run.translation_languages, - [{'code': 'es', 'label': 'Spanish'}] + [{'code': 'fr', 'label': 'French'}] ) self.assertListEqual( active_non_marketable_course_run.translation_languages, [{'code': 'fr', 'label': 'French'}] ) + self.assertListEqual(non_active_non_marketable_course_run.translation_languages,[]) def test_command_no_partner(self, _): """Test the command raises an error if no valid partner is found."""