Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #21 from edx-solutions/hasnain-naveed/YONK-1920
Browse files Browse the repository at this point in the history
YONK-1920 | Merging the rebase-juniper into the master.
  • Loading branch information
hasnain-naveed committed Mar 4, 2021
2 parents 039c9b0 + 62cc7f7 commit ee8525a
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 41 deletions.
6 changes: 2 additions & 4 deletions course_metadata/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import django.utils.timezone
from django.db import migrations, models

import model_utils.fields
from opaque_keys.edx.django.models import CourseKeyField

Expand Down
8 changes: 3 additions & 5 deletions course_metadata/migrations/0002_auto_20180105_0836.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import django.utils.timezone
from opaque_keys.edx.django.models import CourseKeyField
from django.db import migrations, models

import model_utils.fields
from opaque_keys.edx.django.models import CourseKeyField


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
2 changes: 1 addition & 1 deletion course_metadata/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ class CourseSetting(TimeStampedModel):
"""
This model have custom course settings.
"""
id = CourseKeyField(primary_key=True, max_length=255)
id = CourseKeyField(primary_key=True, max_length=255)
4 changes: 2 additions & 2 deletions course_metadata/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from rest_framework import serializers
from openedx.core.lib.api.serializers import CourseKeyField
from course_metadata.models import CourseSetting
from openedx.core.lib.api.serializers import CourseKeyField
from rest_framework import serializers


class CourseSettingSerializer(serializers.ModelSerializer):
Expand Down
18 changes: 8 additions & 10 deletions course_metadata/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"""
Tests for course_metadata app
"""
from django.core.urlresolvers import reverse
from django.urls import reverse

from course_metadata.models import CourseAggregatedMetaData
from edx_solutions_api_integration.test_utils import APIClientMixin
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import (
ModuleStoreTestCase,
TEST_DATA_SPLIT_MODULESTORE
)
TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase)
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory


class CoursesMetaDataTests(ModuleStoreTestCase):
Expand All @@ -19,7 +17,7 @@ class CoursesMetaDataTests(ModuleStoreTestCase):
ENABLED_SIGNALS = ['course_published']

def setUp(self):
super(CoursesMetaDataTests, self).setUp()
super().setUp()

self.course = CourseFactory.create()
self.test_data = '<html>Test data</html>'
Expand All @@ -32,13 +30,13 @@ def setUp(self):
self.sub_section = ItemFactory.create(
parent_location=self.chapter.location,
category="sequential",
display_name=u"test subsection",
display_name="test subsection",
)
self.unit = ItemFactory.create(
parent_location=self.sub_section.location,
category="vertical",
metadata={'graded': True, 'format': 'Homework'},
display_name=u"test unit",
display_name="test unit",
)
self.content_child1 = ItemFactory.create(
category="html",
Expand All @@ -62,10 +60,10 @@ class CourseSettingTests(ModuleStoreTestCase, APIClientMixin):
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE

def setUp(self):
super(CourseSettingTests, self).setUp()
super().setUp()

self.course = CourseFactory.create()
self.course_settings_uri = reverse('additional-course-settings', kwargs={'course_id': unicode(self.course.id)})
self.course_settings_uri = reverse('additional-course-settings', kwargs={'course_id': str(self.course.id)})

def test_course_settings_get(self):
"""
Expand Down
18 changes: 8 additions & 10 deletions course_metadata/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@
"""
# pylint: disable=no-member

import ddt

from django.test.utils import override_settings

import ddt
from course_metadata.utils import get_course_leaf_nodes
from student.tests.factories import UserFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory

from course_metadata.utils import get_course_leaf_nodes


@ddt.ddt
class UtilsTests(ModuleStoreTestCase):
""" Test suite to test operation in utils"""

def setUp(self):
super(UtilsTests, self).setUp()
super().setUp()

self.course = CourseFactory.create()
self.test_data = '<html>Test data</html>'
Expand All @@ -35,30 +33,30 @@ def setUp(self):
self.sub_section = ItemFactory.create(
parent_location=self.chapter.location,
category="sequential",
display_name=u"test subsection",
display_name="test subsection",
)
self.sub_section2 = ItemFactory.create(
parent_location=self.chapter.location,
category="sequential",
display_name=u"test subsection 2",
display_name="test subsection 2",
)
self.vertical = ItemFactory.create(
parent_location=self.sub_section.location,
category="vertical",
metadata={'graded': True, 'format': 'Homework'},
display_name=u"test vertical",
display_name="test vertical",
)
self.vertical2 = ItemFactory.create(
parent_location=self.sub_section2.location,
category="vertical",
metadata={'graded': True, 'format': 'FinalExam'},
display_name=u"test vertical 2",
display_name="test vertical 2",
)
self.vertical3 = ItemFactory.create(
parent_location=self.sub_section2.location,
category="vertical",
metadata={'graded': True, 'format': 'Lab'},
display_name=u"Course Discussion",
display_name="Course Discussion",
)
self.content_child1 = ItemFactory.create(
category="html",
Expand Down
2 changes: 1 addition & 1 deletion course_metadata/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from django.conf import settings
from django.db.models import Q

from xmodule.modulestore.django import modulestore
from student.models import CourseEnrollment
from xmodule.modulestore.django import modulestore


def remove_orphans(course_key, detached_categories):
Expand Down
4 changes: 2 additions & 2 deletions course_metadata/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from opaque_keys.edx.keys import CourseKey
from edx_solutions_api_integration.permissions import SecureRetrieveUpdateAPIView
from course_metadata.models import CourseSetting
from course_metadata.serializers import CourseSettingSerializer
from edx_solutions_api_integration.permissions import SecureRetrieveUpdateAPIView
from opaque_keys.edx.keys import CourseKey


class CourseSettingView(SecureRetrieveUpdateAPIView):
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/usr/bin/env python

from setuptools import setup, find_packages
from setuptools import find_packages, setup

setup(
name='course-edx-platform-extensions',
version='3.0.0',
version='4.0.0',
description='Course metadata management extension for edX platform',
long_description=open('README.rst').read(),
author='edX',
url='https://github.com/edx-solutions/course-edx-platform-extensions.git',
packages=find_packages(),
include_package_data=True,
install_requires=[
"Django>=1.11,<1.12",
"Django>=2.2,<2.3",
],
)

0 comments on commit ee8525a

Please sign in to comment.