Revert "feat: removed piazza from discussion providers"

This commit is contained in:
Muhammad Adeel Tajamul
2022-05-11 11:13:15 +05:00
committed by adeel.tajamul
parent f22a129b23
commit 93dbb03984
3 changed files with 65 additions and 12 deletions

View File

@@ -0,0 +1,24 @@
# Generated by Django 3.2.13 on 2022-05-11 08:27
from django.db import migrations, models
import django_mysql.models
class Migration(migrations.Migration):
dependencies = [
('discussions', '0011_auto_20220510_0716'),
]
operations = [
migrations.AlterField(
model_name='providerfilter',
name='allow',
field=django_mysql.models.ListCharField(models.CharField(choices=[('legacy', 'legacy'), ('openedx', 'openedx'), ('ed-discuss', 'ed-discuss'), ('inscribe', 'inscribe'), ('piazza', 'piazza'), ('yellowdig', 'yellowdig')], max_length=20), blank=True, help_text='Comma-separated list of providers to allow, eg: legacy,openedx,ed-discuss,inscribe,piazza,yellowdig', max_length=63, size=3, verbose_name='Allow List'),
),
migrations.AlterField(
model_name='providerfilter',
name='deny',
field=django_mysql.models.ListCharField(models.CharField(choices=[('legacy', 'legacy'), ('openedx', 'openedx'), ('ed-discuss', 'ed-discuss'), ('inscribe', 'inscribe'), ('piazza', 'piazza'), ('yellowdig', 'yellowdig')], max_length=20), blank=True, help_text='Comma-separated list of providers to deny, eg: legacy,openedx,ed-discuss,inscribe,piazza,yellowdig', max_length=63, size=3, verbose_name='Deny List'),
),
]

View File

@@ -40,6 +40,7 @@ class Provider:
LEGACY = 'legacy'
ED_DISCUSS = 'ed-discuss'
INSCRIBE = 'inscribe'
PIAZZA = 'piazza'
YELLOWDIG = 'yellowdig'
OPEN_EDX = 'openedx'
@@ -228,6 +229,31 @@ AVAILABLE_PROVIDER_MAP = {
'has_full_support': False,
'admin_only_config': True,
},
Provider.PIAZZA: {
'features': [
Features.PRIMARY_DISCUSSION_APP_EXPERIENCE.value,
Features.BASIC_CONFIGURATION.value,
Features.QUESTION_DISCUSSION_SUPPORT.value,
Features.COMMUNITY_TA_SUPPORT.value,
Features.REPORT_FLAG_CONTENT_TO_MODERATORS.value,
Features.LTI_ADVANCED_SHARING_MODE.value,
Features.ANONYMOUS_POSTING.value,
Features.EMAIL_NOTIFICATIONS.value,
Features.WCAG_2_0_SUPPORT.value,
Features.BLACKOUT_DISCUSSION_DATES.value,
],
'supports_lti': True,
'external_links': ProviderExternalLinks(
learn_more='https://piazza.com/product/overview',
configuration='https://support.piazza.com/support/solutions/articles/48001065447-configure-piazza-within-edx', # pylint: disable=line-too-long
general='https://support.piazza.com/',
accessibility='https://piazza.com/product/accessibility',
contact_email='team@piazza.com',
)._asdict(),
'messages': [],
'has_full_support': False,
'admin_only_config': True
},
Provider.YELLOWDIG: {
'features': [
Features.PRIMARY_DISCUSSION_APP_EXPERIENCE.value,

View File

@@ -270,7 +270,7 @@ class DataTest(AuthorizedApiTest):
assert data['lti_configuration'] == DEFAULT_LTI_CONFIGURATION
assert data['plugin_configuration'] == DEFAULT_LEGACY_CONFIGURATION
def _configure_lti_discussion_provider(self, provider=Provider.ED_DISCUSS):
def _configure_lti_discussion_provider(self, provider=Provider.PIAZZA):
"""
Configure an LTI-based discussion provider for a course.
"""
@@ -319,6 +319,7 @@ class DataTest(AuthorizedApiTest):
@ddt.data(
Provider.ED_DISCUSS,
Provider.INSCRIBE,
Provider.PIAZZA,
Provider.YELLOWDIG,
)
def test_add_valid_configuration(self, provider_type):
@@ -346,7 +347,7 @@ class DataTest(AuthorizedApiTest):
provider from edx provider to other provider.
"""
payload = {
'provider_type': Provider.ED_DISCUSS,
'provider_type': Provider.PIAZZA,
'plugin_configuration': {
'allow_anonymous': False,
'custom_field': 'custom_value',
@@ -364,7 +365,7 @@ class DataTest(AuthorizedApiTest):
course = self.store.get_course(self.course.id)
# Only configuration fields not stored in the course, or
# directly in the model should be stored here.
assert course.discussions_settings['ed-discuss'] == {'custom_field': 'custom_value'}
assert course.discussions_settings['piazza'] == {'custom_field': 'custom_value'}
@ddt.data(
# If the legacy provider is selected show the legacy provider only
@@ -377,8 +378,8 @@ class DataTest(AuthorizedApiTest):
(Provider.OPEN_EDX, [Provider.OPEN_EDX], Provider.LEGACY, True),
# If some other provider is selected show the new provider
# if the mfe is enabled
(Provider.ED_DISCUSS, [Provider.LEGACY], Provider.OPEN_EDX, False),
(Provider.ED_DISCUSS, [Provider.OPEN_EDX, Provider.LEGACY], 'dummy', True),
(Provider.PIAZZA, [Provider.LEGACY], Provider.OPEN_EDX, False),
(Provider.PIAZZA, [Provider.OPEN_EDX, Provider.LEGACY], 'dummy', True),
)
@ddt.unpack
def test_available_providers_legacy(
@@ -419,7 +420,7 @@ class DataTest(AuthorizedApiTest):
"""
payload = {
'enabled': True,
'provider_type': Provider.ED_DISCUSS,
'provider_type': Provider.PIAZZA,
'lti_configuration': {
key: value,
}
@@ -428,7 +429,7 @@ class DataTest(AuthorizedApiTest):
data = self.get()
assert data['enabled']
assert data['provider_type'] == Provider.ED_DISCUSS
assert data['provider_type'] == Provider.PIAZZA
assert data['lti_configuration'][key] == value
def test_post_lti_invalid(self):
@@ -440,7 +441,7 @@ class DataTest(AuthorizedApiTest):
for key, value in DATA_POST_LTI_CONFIGURATION.items():
payload = {
'enabled': True,
'provider_type': Provider.ED_DISCUSS,
'provider_type': Provider.PIAZZA,
'lti_configuration': {
key: value,
'ignored-key': 'ignored value',
@@ -450,7 +451,7 @@ class DataTest(AuthorizedApiTest):
assert response.status_code == status.HTTP_200_OK
data = self.get()
assert data['enabled']
assert data['provider_type'] == Provider.ED_DISCUSS
assert data['provider_type'] == Provider.PIAZZA
assert data['lti_configuration'][key] == value
assert 'ignored-key' not in data['lti_configuration']
@@ -561,7 +562,7 @@ class DataTest(AuthorizedApiTest):
["enable_in_context", "enable_graded_units", "unit_level_visibility"],
[True, False],
),
("provider_type", Provider.ED_DISCUSS),
("provider_type", Provider.PIAZZA),
)
@ddt.unpack
def test_change_course_fields(self, field, value):
@@ -603,7 +604,7 @@ class DataTest(AuthorizedApiTest):
response = self._post({
'enabled': True,
'provider_type': 'ed-discuss',
'provider_type': 'piazza',
})
assert response.status_code == status.HTTP_403_FORBIDDEN
@@ -624,7 +625,7 @@ class DataTest(AuthorizedApiTest):
response = self._post({
'enabled': True,
'provider_type': 'ed-discuss',
'provider_type': 'piazza',
})
assert response.status_code == status.HTTP_200_OK
@@ -751,6 +752,7 @@ class PIISettingsAPITests(DataTest):
@ddt.data(
Provider.ED_DISCUSS,
Provider.INSCRIBE,
Provider.PIAZZA,
Provider.YELLOWDIG,
)
def test_post_everything_with_pii_disabled(self, provider):
@@ -773,6 +775,7 @@ class PIISettingsAPITests(DataTest):
@ddt.data(
Provider.ED_DISCUSS,
Provider.INSCRIBE,
Provider.PIAZZA,
Provider.YELLOWDIG,
)
def test_post_everything_with_pii_enabled(self, provider):