-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: DiscussionsConfigurations admin error
- Loading branch information
1 parent
475b49c
commit 8f7496d
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Tests for DiscussionsConfiguration admin view | ||
""" | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
|
||
from common.djangoapps.student.tests.factories import UserFactory | ||
from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration, Provider | ||
|
||
|
||
class DiscussionsConfigurationAdminTest(TestCase): | ||
""" | ||
Tests for discussion config admin | ||
""" | ||
def setUp(self): | ||
super().setUp() | ||
self.superuser = UserFactory(is_staff=True, is_superuser=True) | ||
self.client.login(username=self.superuser.username, password="Password1234") | ||
|
||
def test_change_view(self): | ||
""" | ||
Test that the DiscussionAdmin's change_view processes the context_key correctly and returns a successful | ||
response. | ||
""" | ||
discussion_config = DiscussionsConfiguration.objects.create( | ||
context_key='course-v1:test+test+06_25_2024', | ||
provider_type=Provider.OPEN_EDX, | ||
) | ||
url = reverse('admin:discussions_discussionsconfiguration_change', args=[discussion_config.context_key]) | ||
response = self.client.get(url) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertContains(response, 'course-v1:test+test+06_25_2024') |