-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Add Programs tab to Studio #10701
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
Add Programs tab to Studio #10701
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| """Tests covering the Programs listing on the Studio home.""" | ||
| from django.core.urlresolvers import reverse | ||
| import httpretty | ||
| from oauth2_provider.tests.factories import ClientFactory | ||
| from provider.constants import CONFIDENTIAL | ||
|
|
||
| from openedx.core.djangoapps.programs.models import ProgramsApiConfig | ||
| from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin, ProgramsDataMixin | ||
| from student.tests.factories import UserFactory | ||
| from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase | ||
|
|
||
|
|
||
| class TestProgramListing(ProgramsApiConfigMixin, ProgramsDataMixin, ModuleStoreTestCase): | ||
| """Verify Program listing behavior.""" | ||
| def setUp(self): | ||
| super(TestProgramListing, self).setUp() | ||
|
|
||
| ClientFactory(name=ProgramsApiConfig.OAUTH2_CLIENT_NAME, client_type=CONFIDENTIAL) | ||
|
|
||
| self.user = UserFactory(is_staff=True) | ||
| self.client.login(username=self.user.username, password='test') | ||
|
|
||
| self.studio_home = reverse('home') | ||
|
|
||
| @httpretty.activate | ||
| def test_programs_config_disabled(self): | ||
| """Verify that the programs tab and creation button aren't rendered when config is disabled.""" | ||
| self.create_config(enable_studio_tab=False) | ||
| self.mock_programs_api() | ||
|
|
||
| response = self.client.get(self.studio_home) | ||
|
|
||
| self.assertNotIn("You haven't created any programs yet.", response.content) | ||
|
|
||
| for program_name in self.PROGRAM_NAMES: | ||
| self.assertNotIn(program_name, response.content) | ||
|
|
||
| @httpretty.activate | ||
| def test_programs_requires_staff(self): | ||
| """Verify that the programs tab and creation button aren't rendered unless the user has global staff.""" | ||
| self.user = UserFactory(is_staff=False) | ||
| self.client.login(username=self.user.username, password='test') | ||
|
|
||
| self.create_config() | ||
| self.mock_programs_api() | ||
|
|
||
| response = self.client.get(self.studio_home) | ||
| self.assertNotIn("You haven't created any programs yet.", response.content) | ||
|
|
||
| @httpretty.activate | ||
| def test_programs_displayed(self): | ||
| """Verify that the programs tab and creation button can be rendered when config is enabled.""" | ||
| self.create_config() | ||
|
|
||
| # When no data is provided, expect creation prompt. | ||
| self.mock_programs_api(data={'results': []}) | ||
|
|
||
| response = self.client.get(self.studio_home) | ||
| self.assertIn("You haven't created any programs yet.", response.content) | ||
|
|
||
| # When data is provided, expect a program listing. | ||
| self.mock_programs_api() | ||
|
|
||
| response = self.client.get(self.studio_home) | ||
| for program_name in self.PROGRAM_NAMES: | ||
| self.assertIn(program_name, response.content) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -806,6 +806,11 @@ | |
| # Self-paced course configuration | ||
| 'openedx.core.djangoapps.self_paced', | ||
|
|
||
| # OAuth2 Provider | ||
| 'provider', | ||
| 'provider.oauth2', | ||
| 'oauth2_provider', | ||
|
|
||
| # These are apps that aren't strictly needed by Studio, but are imported by | ||
| # other apps that are. Django 1.8 wants to have imported models supported | ||
| # by installed apps. | ||
|
|
@@ -1112,3 +1117,9 @@ | |
| 'options': {}, | ||
| } | ||
| PROCTORING_SETTINGS = {} | ||
|
|
||
|
|
||
| ############################ OAUTH2 Provider ################################### | ||
|
|
||
| # OpenID Connect issuer ID. Normally the URL of the authentication endpoint. | ||
| OAUTH_OIDC_ISSUER = 'https://www.example.com/oauth2' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For JWT auth to succeed, this value must match the issuer expected by Programs. At the moment, Programs expects the value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My opinion is that the "issuer" is our auth provider, whose host is courses.edx.org (more by convenience than by design). I think that would be the correct value.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I/we need to open a DevOps ticket to make sure this setting is overridden with the correct value.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jimabramson it looks like our configuration is already set up correctly, so we should get this for free. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice. |
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not your fault, but this is an insane tangle of imports!