From 5e66997cf993f1f1538b7f04ba709785c1ac7569 Mon Sep 17 00:00:00 2001 From: Viktor Rusakov <52399399+ViktorRusakov@users.noreply.github.com> Date: Wed, 14 Jul 2021 23:19:40 +0300 Subject: [PATCH] feat: [BD-26] Fix generic backend providers to include missing method (#903) * fix: add get_proctoring_config method to generic backend provider class which caused learning app crash for proctored exams setup with generic providers * tests: add additional test for base backend provider class * docs: update package version and changelog --- CHANGELOG.rst | 6 +++++- edx_proctoring/__init__.py | 2 +- edx_proctoring/backends/backend.py | 6 ++++++ edx_proctoring/backends/software_secure.py | 12 ++++++++++++ edx_proctoring/backends/tests/test_backend.py | 2 ++ .../backends/tests/test_software_secure.py | 11 +++++++++++ package.json | 2 +- 7 files changed, 38 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 939e004dd83..b2a471b6842 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,7 +14,11 @@ Change Log Unreleased ~~~~~~~~~~ -[3.17.1] - 2021-07-2 +[3.17.3] - 2021-07-14 +~~~~~~~~~~~~~~~~~~~~~ +* Add missing get_proctoring_config method to base backend provider class. + +[3.17.2] - 2021-07-2 ~~~~~~~~~~~~~~~~~~~~~ * Updated ProctoredExamAttempt view to use the content id from the query. diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index 6164d7790eb..778fabe18a3 100644 --- a/edx_proctoring/__init__.py +++ b/edx_proctoring/__init__.py @@ -3,6 +3,6 @@ """ # Be sure to update the version number in edx_proctoring/package.json -__version__ = '3.17.2' +__version__ = '3.17.3' default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name diff --git a/edx_proctoring/backends/backend.py b/edx_proctoring/backends/backend.py index e71479b5263..54baeb45f00 100644 --- a/edx_proctoring/backends/backend.py +++ b/edx_proctoring/backends/backend.py @@ -139,3 +139,9 @@ def get_onboarding_profile_info(self, course_id, **kwargs): Returns onboarding profile information for a given course and optional user """ return None + + def get_proctoring_config(self): + """ + Returns the metadata and configuration options for the proctoring service + """ + return None diff --git a/edx_proctoring/backends/software_secure.py b/edx_proctoring/backends/software_secure.py index 0409c835975..a265eae53dd 100644 --- a/edx_proctoring/backends/software_secure.py +++ b/edx_proctoring/backends/software_secure.py @@ -390,3 +390,15 @@ def should_block_access_to_exam_material(self): req = get_current_request() # pylint: disable=illegal-waffle-usage return not req.get_signed_cookie('exam', default=False) + + def get_proctoring_config(self): + """ + Returns the metadata and configuration options for the proctoring service + """ + proctoring_config = { + 'download_url': self.get_software_download_url(), + 'name': self.verbose_name, + 'rules': {}, + 'instructions': [] + } + return proctoring_config diff --git a/edx_proctoring/backends/tests/test_backend.py b/edx_proctoring/backends/tests/test_backend.py index 6392a73f3b2..2674d394967 100644 --- a/edx_proctoring/backends/tests/test_backend.py +++ b/edx_proctoring/backends/tests/test_backend.py @@ -226,6 +226,8 @@ def test_raises_exception(self): self.assertIsNone(provider.get_onboarding_profile_info(course_id='test')) + self.assertIsNone(provider.get_proctoring_config()) + def test_null_provider(self): """ Assert that the Null provider does nothing diff --git a/edx_proctoring/backends/tests/test_software_secure.py b/edx_proctoring/backends/tests/test_software_secure.py index 1cc6fb0fc7b..3eaaf07a9e6 100644 --- a/edx_proctoring/backends/tests/test_software_secure.py +++ b/edx_proctoring/backends/tests/test_software_secure.py @@ -125,6 +125,17 @@ def test_get_software_download_url(self): provider = get_backend_provider() self.assertEqual(provider.get_software_download_url(), 'http://example.com') + def test_get_proctoring_config(self): + """ + Makes sure proctoring config is returned + """ + + provider = get_backend_provider() + config = provider.get_proctoring_config() + self.assertIsNotNone(config) + self.assertEqual(config['name'], provider.verbose_name) + self.assertEqual(config['download_url'], 'http://example.com') + def test_register_attempt(self): """ Makes sure we can register an attempt diff --git a/package.json b/package.json index 83408eb4410..5d47be52bdf 100644 --- a/package.json +++ b/package.json @@ -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": "3.17.2", + "version": "3.17.3", "main": "edx_proctoring/static/index.js", "scripts": { "test": "gulp test"