Skip to content

Commit

Permalink
Backend-specific dashboard launches depend on the name field
Browse files Browse the repository at this point in the history
... being set and fail if there is none. We were drawing in this
information from the auth_user.first_name and .last_name fields, which
are deprecated on the edX platform.
  • Loading branch information
Matt Hughes committed Jun 14, 2019
1 parent 113b98b commit e18915e
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ language: python
cache: pip
python:
- 2.7
services:
- xvfb
env:
- DJANGO_SETTINGS_MODULE=test_setting TOXENV=django111-drf37
- DJANGO_SETTINGS_MODULE=test_setting TOXENV=django111-drf38
Expand All @@ -12,7 +14,6 @@ env:
- TOXENV=translations
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
install:
- pip install tox-travis
- pip install -r requirements/test.txt
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
from __future__ import absolute_import

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '2.0.3'
__version__ = '2.0.4'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
6 changes: 6 additions & 0 deletions edx_proctoring/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
from edx_proctoring.runtime import set_runtime_service, get_runtime_service
from edx_proctoring.urls import urlpatterns

from mock_apps.models import Profile

from .test_services import MockCreditService, MockInstructorService
from .utils import LoggedInTestCase

Expand Down Expand Up @@ -2600,6 +2602,10 @@ class TestInstructorDashboard(LoggedInTestCase):
"""
def setUp(self):
super(TestInstructorDashboard, self).setUp()
profile = Profile()
profile.name = 'boo radley'
profile.user = self.user
profile.save()
self.user.is_staff = True
self.user.save()
self.second_user = User(username='tester2', email='[email protected]')
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ def get(self, request, course_id, exam_id=None):
if backend:
user = {
'id': obscured_user_id(request.user.id, exam['backend']),
'full_name': request.user.get_full_name(),
'full_name': request.user.profile.name,
'email': request.user.email
}

Expand Down
Empty file added mock_apps/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions mock_apps/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.apps import AppConfig


class MockAppsConfig(AppConfig):
name = 'mock_apps'
10 changes: 10 additions & 0 deletions mock_apps/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib.auth import get_user_model
from django.db import models

class Profile(models.Model):
user = models.OneToOneField(get_user_model())
name = models.CharField(max_length=100)

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@edx/edx-proctoring",
"//": "Be sure to update the version number in edx_proctoring/__init__.py",
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.",
"version": "2.0.3",
"version": "2.0.4",
"main": "edx_proctoring/static/index.js",
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
'edx_when',
'rules.apps.AutodiscoverRulesConfig',
'waffle',
'mock_apps',
)

AUTHENTICATION_BACKENDS = [
Expand Down

0 comments on commit e18915e

Please sign in to comment.